1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.controls;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20
21
22
23
24 public class DemoControlTextAreaAft extends WebDriverLegacyITBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TextAreaControlView";
30
31 @Override
32 protected String getBookmarkUrl() {
33 return BOOKMARK_URL;
34 }
35
36 @Override
37 protected void navigate() throws Exception {
38 waitAndClickById("Demo-LibraryLink", "");
39 waitAndClickByLinkText("Controls");
40 waitAndClickByLinkText("Text Area");
41 }
42
43 protected void testLibraryControlTextAreaDefault() throws Exception {
44 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example1']/textarea[@name='inputField2' and @rows='3' and @cols='40']");
45 }
46
47 protected void testLibraryControlTextAreaColsAndRowsSet() throws Exception {
48 waitAndClickByLinkText("Cols and Rows set");
49 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example2']/textarea[@name='inputField2' and @rows='5' and @cols='60']");
50 }
51
52 protected void testLibraryControlTextAreaTextExpand() throws Exception {
53 waitAndClickByLinkText("Text expand");
54 assertElementPresentByXpath("//textarea[@name='inputField2' and @rows='3' and @cols='40']");
55 assertElementPresentByXpath("//a[@title='Expand']");
56 }
57
58 protected void testLibraryControlTextAreaDisabled() throws Exception {
59 waitAndClickByLinkText("Disabled");
60 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example4']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @disabled]");
61 }
62
63 protected void testLibraryControlTextAreaWatermarkText() throws Exception {
64 waitAndClickByLinkText("WatermarkText");
65 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example7']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @placeholder='watermark text ']");
66 }
67
68 protected void testLibraryControlTextAreaEvaluateDisabledOnKeyUp() throws Exception {
69 waitAndClickByLinkText("Evaluate disabled on key up");
70 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @disabled]");
71 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField1']","a");
72 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField2' and @rows='3' and @cols='40']");
73 }
74
75 protected void testLibraryControlTextAreaEnableWhenChanged() throws Exception {
76 waitAndClickByLinkText("Enable when changed");
77 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField4' and @rows='3' and @cols='40' and @disabled]");
78 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField3']","a");
79 waitAndClickLinkContainingText("Library Navigation");
80 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField4' and @rows='3' and @cols='40']");
81 }
82
83 protected void testLibraryControlTextAreaDisableWhenChanged() throws Exception {
84 waitAndClickByLinkText("Disable when changed");
85 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField6' and @rows='3' and @cols='40']");
86 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField5']","a");
87 fireEvent("inputField5", "blur");
88 waitAndClickLinkContainingText("Library Navigation");
89 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField6' and @rows='3' and @cols='40' and @disabled]");
90 }
91
92 @Test
93 public void testControlTextAreaBookmark() throws Exception {
94 testLibraryControlTextArea();
95 passed();
96 }
97
98 @Test
99 public void testControlTextAreaNav() throws Exception {
100 testLibraryControlTextArea();
101 passed();
102 }
103
104 private void testLibraryControlTextArea() throws Exception {
105 testLibraryControlTextAreaDefault();
106 testLibraryControlTextAreaColsAndRowsSet();
107 testLibraryControlTextAreaTextExpand();
108 testLibraryControlTextAreaDisabled();
109 testLibraryControlTextAreaWatermarkText();
110 testLibraryControlTextAreaEvaluateDisabledOnKeyUp();
111 testLibraryControlTextAreaEnableWhenChanged();
112 testLibraryControlTextAreaDisableWhenChanged();
113 }
114 }