Author: ppitonak(a)redhat.com
Date: 2010-11-15 10:22:36 -0500 (Mon, 15 Nov 2010)
New Revision: 20048
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
Log:
* testLang added to AbstractMetamerTest
* all tests for lang attribute refactored
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-11-15
14:36:50 UTC (rev 20047)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-11-15
15:22:36 UTC (rev 20048)
@@ -185,7 +185,7 @@
* @param element
* locator of tested element
* @param attribute
- * name of the attribute that will be set (e.g. styleClass, headerClass,
itemContentClass
+ * name of the attribute that will be set (e.g. styleClass, headerClass,
itemContentClass)
*/
protected void testStyleClass(ElementLocator<?> element, String attribute) {
ElementLocator<?> classInput = pjq("input[id$=" + attribute +
"Input]");
@@ -227,6 +227,28 @@
}
/**
+ * A helper method for testing attribute "lang".
+ *
+ * @param element
+ * locator of tested element
+ */
+ protected void testLang(ElementLocator<?> element) {
+ JQueryLocator langInput = pjq("input[type=text][id$=langInput]");
+
+ // lang = null
+ AttributeLocator<?> langAttr = element.getAttribute(new
Attribute("lang"));
+ assertFalse(selenium.isAttributePresent(langAttr), "Attribute xml:lang
should not be present.");
+
+ selenium.type(langInput, "sk");
+ selenium.waitForPageToLoad();
+
+ // lang = sk
+ langAttr = element.getAttribute(new Attribute("lang"));
+ assertTrue(selenium.isAttributePresent(langAttr), "Attribute xml:lang should
be present.");
+ assertEquals(selenium.getAttribute(langAttr), "sk", "Attribute
xml:lang should be present.");
+ }
+
+ /**
* Hides header, footer and inputs for attributes.
*/
protected void hideControls() {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-11-15
14:36:50 UTC (rev 20047)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-11-15
15:22:36 UTC (rev 20048)
@@ -129,20 +129,7 @@
@Test
public void testLang() {
- JQueryLocator langInput = pjq("input[id$=langInput]");
- AttributeLocator<?> attributeLang = outputDiv.getAttribute(new
Attribute("lang"));
-
- selenium.typeKeys(langInput, "en");
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "en", "Lang attribute");
-
- selenium.typeKeys(langInput, "sk");
- selenium.waitForPageToLoad(TIMEOUT);
-
- attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "sk", "Lang attribute");
+ testLang(outputDiv);
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-11-15
14:36:50 UTC (rev 20047)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-11-15
15:22:36 UTC (rev 20048)
@@ -293,19 +293,7 @@
@Test
public void testLang() {
- JQueryLocator langInput = pjq("input[type=text][id$=langInput]");
-
- // lang = null
- AttributeLocator<?> langAttr = accordion.getAttribute(new
Attribute("xml|lang"));
- assertFalse(selenium.isAttributePresent(langAttr), "Attribute xml:lang
should not be present.");
-
- selenium.type(langInput, "sk");
- selenium.waitForPageToLoad();
-
- // lang = sk
- langAttr = accordion.getAttribute(new Attribute("lang"));
- assertTrue(selenium.isAttributePresent(langAttr), "Attribute xml:lang should
be present.");
- assertEquals(selenium.getAttribute(langAttr), "sk", "Attribute
xml:lang should be present.");
+ testLang(accordion);
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2010-11-15
14:36:50 UTC (rev 20047)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2010-11-15
15:22:36 UTC (rev 20048)
@@ -219,19 +219,7 @@
@Test
public void testLang() {
- JQueryLocator langInput = pjq("input[type=text][id$=langInput]");
-
- // lang = null
- AttributeLocator<?> langAttr = tab.getAttribute(new
Attribute("lang"));
- assertFalse(selenium.isAttributePresent(langAttr), "Attribute xml:lang
should not be present.");
-
- selenium.type(langInput, "sk");
- selenium.waitForPageToLoad();
-
- // lang = sk
- langAttr = tab.getAttribute(new Attribute("lang"));
- assertTrue(selenium.isAttributePresent(langAttr), "Attribute xml:lang should
be present.");
- assertEquals(selenium.getAttribute(langAttr), "sk", "Attribute
xml:lang should be present.");
+ testLang(tab);
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2010-11-15
14:36:50 UTC (rev 20047)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2010-11-15
15:22:36 UTC (rev 20048)
@@ -204,19 +204,7 @@
@Test
public void testLang() {
- JQueryLocator langInput = pjq("input[type=text][id$=langInput]");
-
- // lang = null
- AttributeLocator<?> langAttr = panel.getAttribute(new
Attribute("xml|lang"));
- assertFalse(selenium.isAttributePresent(langAttr), "Attribute xml:lang
should not be present.");
-
- selenium.type(langInput, "sk");
- selenium.waitForPageToLoad();
-
- // lang = sk
- langAttr = panel.getAttribute(new Attribute("lang"));
- assertTrue(selenium.isAttributePresent(langAttr), "Attribute xml:lang should
be present.");
- assertEquals(selenium.getAttribute(langAttr), "sk", "Attribute
xml:lang should be present.");
+ testLang(panel);
}
@Test