Author: konstantin.mishin
Date: 2009-03-09 14:31:50 -0400 (Mon, 09 Mar 2009)
New Revision: 12896
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/hotKey/hotKey.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/HotKeyTest.java
Log:
RF-6289
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/hotKey/hotKey.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/hotKey/hotKey.xhtml 2009-03-09
17:53:40 UTC (rev 12895)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/hotKey/hotKey.xhtml 2009-03-09
18:31:50 UTC (rev 12896)
@@ -15,7 +15,7 @@
</h:inputText>
</h:form>
<h:panelGroup id="panelGroup">
- <rich:hotKey key="#{hotKey.key}"
handler="document.getElementById('input').value =
'#{hotKey.key}'"/>
+ <rich:hotKey id="hotKey" key="#{hotKey.key}"
handler="document.getElementById('input').value =
'#{hotKey.key}'"/>
<input id="input" />
</h:panelGroup>
</ui:define>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/HotKeyTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/HotKeyTest.java 2009-03-09
17:53:40 UTC (rev 12895)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/HotKeyTest.java 2009-03-09
18:31:50 UTC (rev 12896)
@@ -9,12 +9,15 @@
private String key;
+ private String hotKey;
+
private String input;
private void init(Template template) {
renderPage(null, template, "#{dataList.init}");
String attrForm = getParentId() + "attrForm";
key = attrForm + ":key";
+ hotKey = getParentId() + "hotKey";
input = "input";
}
@@ -22,7 +25,7 @@
* Create hotKey component with timing="immediate"
* (or "onload")attribute and check that it works -
* alpha/numeric/arrows/special(ins/del/pgup/pgdn/home/end)/enter/esc keys
- * and check 'key' attribute
+ * and Check 'key' attribute
*/
@Test
public void testKeyAttribute(Template template) {
@@ -90,6 +93,28 @@
}
+ /**
+ * check 'enable()' and 'disable()' JS API functions
+ */
+ @Test
+ public void testDisableFunction(Template template) {
+ init(template);
+ String keySequence = "return";
+ selenium.type(key, keySequence);
+ waitForAjaxCompletion();
+ selenium.runScript("var hotKey = document.getElementById('" + hotKey +
"').component");
+ Assert.assertEquals(selenium.getValue(input), "");
+ selenium.keyDown(input, "\\13");
+ Assert.assertEquals(selenium.getValue(input), keySequence);
+ selenium.runScript("hotKey.disable()");
+ selenium.type(input, "");
+ selenium.keyDown(input, "\\13");
+ Assert.assertEquals(selenium.getValue(input), "");
+ selenium.runScript("hotKey.enable()");
+ selenium.keyDown(input, "\\13");
+ Assert.assertEquals(selenium.getValue(input), keySequence);
+ }
+
@Override
public String getTestUrl() {
return "pages/hotKey/hotKey.xhtml";
Show replies by date