Author: mareshkau
Date: 2008-02-25 11:50:31 -0500 (Mon, 25 Feb 2008)
New Revision: 6558
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testInsertTag.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-675, junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testInsertTag.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testInsertTag.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testInsertTag.xhtml 2008-02-25
16:50:31 UTC (rev 6558)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <body>
+ <form action="">
+
+ </form>
+ </body>
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-02-25
16:40:33 UTC (rev 6557)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-02-25
16:50:31 UTC (rev 6558)
@@ -94,6 +94,9 @@
styledText.insert("t");
}
+ if(getException()!=null) {
+ throw getException();
+ }
}
/**
* Tests tag Input on Source Page
@@ -152,6 +155,58 @@
styledText.insert("t");
}
+ if(getException()!=null) {
+ throw getException();
+ }
}
+ public void testInsertTagOnPage() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ // Tests CA
+ // get test page path
+ IFile file = (IFile)
TestUtil.getComponentPath("JBIDE/675/testInsertTag.xhtml",
+ IMPORT_PROJECT_NAME);
+ assertNotNull("Could not open specified file " +
"JBIDE/675/testInsertTag.xhtml", file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ StyledText styledText = part.getSourceEditor().getTextViewer()
+ .getTextWidget();
+
+ styledText.setCaretOffset(285);
+ styledText.insert("<test></test>");
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(part
+ .getSourceEditor().getTextViewer(), 290);
+ Node node = (Node) treeNode;
+ assertNotNull(node);
+
+ VpeController vpeController = getVpeController(part);
+
+ VpeDomMapping domMapping = vpeController.getDomMapping();
+
+ VpeNodeMapping nodeMapping = domMapping.getNodeMapping(node);
+
+ assertNotNull(nodeMapping);
+
+ nsIDOMNode div = nodeMapping.getVisualNode();
+
+ nsIDOMNode span = div.getFirstChild();
+
+ nsIDOMNode textNode = span.getFirstChild();
+
+ assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
+
+ assertNotNull(textNode.getNodeValue());
+ assertNotNull(node.getNodeName());
+ assertEquals(textNode.getNodeValue().trim(), node.getNodeName()
+ .trim());
+ }
}