1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.component;
17
18
19
20
21
22
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.kuali.rice.krad.uif.control.FileControl;
27 import org.kuali.rice.krad.uif.control.TextAreaControl;
28 import org.kuali.rice.krad.uif.control.TextControl;
29 import org.kuali.rice.krad.uif.control.UserControl;
30 import org.kuali.rice.krad.uif.element.Action;
31 import org.kuali.rice.krad.uif.element.Image;
32 import org.kuali.rice.krad.uif.element.Message;
33 import org.kuali.rice.krad.uif.field.LinkField;
34
35 import java.util.TreeMap;
36
37 import static junit.framework.Assert.assertFalse;
38 import static junit.framework.Assert.assertTrue;
39 import static org.junit.Assert.assertEquals;
40 import static org.junit.Assert.assertNotNull;
41
42
43
44
45 public class ComponentBaseTest {
46 private Component component;
47 private TreeMap<String, String> dataAttributes;
48
49 @Before
50 public void setUp() throws Exception {
51
52 component = new Action();
53 component.setId("action1");
54
55 dataAttributes = new TreeMap<String, String>();
56
57 dataAttributes.put("iconTemplateName", "cool-icon-%s.png");
58 dataAttributes.put("transitions", "3");
59 component.setDataAttributes(dataAttributes);
60 }
61
62 @Test
63
64
65
66 public void testGetSimpleDataAttributes() throws Exception {
67 assertNotNull(component.getSimpleDataAttributes());
68 String expected = " data-iconTemplateName=\"cool-icon-%s.png\" data-transitions=\"3\"";
69 assertEquals("simple attributes did not match", expected, component.getSimpleDataAttributes());
70 }
71
72 @Test
73
74
75
76 public void testGetSimpleDataAttributesWhenNull() throws Exception {
77 component.setDataAttributes(null);
78 assertEquals("simple attributes did not match", "", component.getSimpleDataAttributes());
79 }
80 }