Author: dsakovich
Date: 2008-01-11 12:06:32 -0500 (Fri, 11 Jan 2008)
New Revision: 5635
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/repeat.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1524
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/repeat.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/repeat.xhtml 2008-01-11
17:01:37 UTC (rev 5634)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/repeat.xhtml 2008-01-11
17:06:32 UTC (rev 5635)
@@ -8,13 +8,11 @@
<title>Repeat Test</title>
</head>
<body bgcolor="#ffffff">
- <dl>
- <ui:repeat value="#{company.departments}" var="dept">
- <dt>#{dept.name}</dt>
- <ui:repeat value="#{dept.employees}" var="emp">
- <dd>#{emp.lastName}, #{emp.firstName}</dd>
- </ui:repeat>
- </ui:repeat>
+<dl>
+ <ui:repeat value="#{company.departments}" var="dept">
+ <dt>#{dept.name}</dt>
+ <dd>#{dept.lastName}, #{dept.firstName}</dd>
+ </ui:repeat>
</dl>
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java 2008-01-11
17:01:37 UTC (rev 5634)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java 2008-01-11
17:06:32 UTC (rev 5635)
@@ -71,7 +71,8 @@
nsIDOMText text = (nsIDOMText) div.getFirstChild().queryInterface(
nsIDOMText.NS_IDOMTEXT_IID);
- assertEquals(text.getNodeValue(), "Ctrl+Shift+");
+ assertEquals("Debug's content is not shown", text.getNodeValue(),
+ "Ctrl+Shift+");
if (getException() != null) {
throw getException();
@@ -105,8 +106,10 @@
nsIDOMText text1 = (nsIDOMText) elementSpan1.getFirstChild()
.queryInterface(nsIDOMText.NS_IDOMTEXT_IID);
- assertEquals(text0.getNodeValue(), "Greeting Page");
- assertEquals(text1.getNodeValue(), "#{person.name}!");
+ assertEquals("Defined content is not shown", text0.getNodeValue(),
+ "Greeting Page");
+ assertEquals("Defined content is not shown", text1.getNodeValue(),
+ "#{person.name}!");
if (getException() != null) {
throw getException();
@@ -130,7 +133,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with absolute path is not included", 1, elements
+ .size());
// check related path
element =
performTestForFaceletComponent("components/composition_related.xhtml");
@@ -141,7 +145,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with related path is not included", 1, elements
+ .size());
if (getException() != null) {
throw getException();
@@ -175,8 +180,8 @@
String title = div.getAttribute("title");
- assertEquals(title.replaceAll("\\s+", ""),
- "ui:componentbinding:#{backingBean.menu}");
+ assertEquals("Component's content is not shown", title.replaceAll(
+ "\\s+", ""), "ui:componentbinding:#{backingBean.menu}");
if (getException() != null) {
throw getException();
}
@@ -205,8 +210,8 @@
nsIDOMText text = (nsIDOMText) elementSpan.getFirstChild()
.queryInterface(nsIDOMText.NS_IDOMTEXT_IID);
- assertEquals(false, text.getNodeValue().equals(
- "\nThis will be removed.\n"));
+ assertEquals("Content inside ui:remove tag shouldn't be shown", false,
+ text.getNodeValue().equals("\nThis will be removed.\n"));
if (getException() != null) {
throw getException();
@@ -229,7 +234,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with absolute path is not included", 1, elements
+ .size());
// check related path
element =
performTestForFaceletComponent("components/decorate_related.xhtml");
@@ -240,7 +246,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with related path is not included", 1, elements
+ .size());
if (getException() != null) {
throw getException();
@@ -253,9 +260,29 @@
* @throws Throwable
*/
public void testRepeat() throws Throwable {
- performTestForVpeComponent((IFile) TestUtil.getComponentPath(
- "components/repeat.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$
- assertTrue("Component's content is not shown", false);
+ nsIDOMElement element =
performTestForFaceletComponent("components/repeat.xhtml");
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "dl" elements
+ TestUtil.findElementsByName(node, elements, HTML.TAG_DL);
+
+ assertEquals(1, elements.size());
+
+ nsIDOMElement elementDL = (nsIDOMElement) elements.get(0)
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ nsIDOMElement elementDT = (nsIDOMElement) elementDL.getFirstChild()
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ assertEquals("Component's content is not shown", HTML.TAG_DT, elementDT
+ .getNodeName().toUpperCase());
+
+ if (getException() != null) {
+ throw getException();
+ }
}
/**
@@ -274,7 +301,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with absolute path is not included", 1, elements
+ .size());
// check related path
element = performTestForFaceletComponent("components/include_related.xhtml");
@@ -285,7 +313,8 @@
// find "table" elements
TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE);
- assertEquals(1, elements.size());
+ assertEquals("Template with related path is not included", 1, elements
+ .size());
if (getException() != null) {
throw getException();
@@ -318,8 +347,8 @@
String title = div.getAttribute("title");
- assertEquals(title.replaceAll("\\s+", ""),
- "ui:fragmentbinding:#{uiCache['searchResult']}");
+ assertEquals("Fragment's content is not shown", title.replaceAll(
+ "\\s+", ""),
"ui:fragmentbinding:#{uiCache['searchResult']}");
if (getException() != null) {
throw getException();
}