1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.view;
17
18 import static org.junit.Assert.assertNotNull;
19 import static org.junit.Assert.assertTrue;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.kuali.rice.krad.uif.component.BindingInfo;
27 import org.kuali.rice.krad.uif.component.Component;
28 import org.kuali.rice.krad.uif.control.TextControl;
29 import org.kuali.rice.krad.uif.control.TextControlBase;
30 import org.kuali.rice.krad.uif.field.InputField;
31 import org.kuali.rice.krad.uif.field.InputFieldBase;
32
33
34
35
36
37
38 public class ViewIndexTest {
39 @Before
40 public void setUp() throws Exception {
41
42 }
43
44
45
46
47
48
49
50 @Test
51 public void testClearIndexesAfterRender() throws Exception {
52
53 InputField field = new InputFieldBase();
54 BindingInfo bindingInfo = new BindingInfo();
55 bindingInfo.setBindingPath("property1");
56 field.setBindingInfo(bindingInfo);
57 String fieldId = "field1";
58 field.setId(fieldId);
59
60 List<String> refreshWhenChangedPropertyNames = field.getRefreshWhenChangedPropertyNames();
61 refreshWhenChangedPropertyNames = refreshWhenChangedPropertyNames == null ?
62 new ArrayList<String>() : new ArrayList<String>(refreshWhenChangedPropertyNames);
63 refreshWhenChangedPropertyNames.add("#lp.allDay eq true");
64 field.setRefreshWhenChangedPropertyNames(refreshWhenChangedPropertyNames);
65
66
67 TextControl textControl = new TextControlBase();
68 String controlId = "text1";
69 textControl.setId(controlId);
70 field.setControl(textControl);
71
72 final ViewIndex viewIndex = new ViewIndex();
73
74 Component[] components = {field};
75
76
77 for (Component component : components) {
78 viewIndex.indexComponent(component);
79 }
80
81
82 for (Component component : components) {
83 assertNotNull(viewIndex.getComponentById(component.getId()));
84 }
85 }
86 }