Author: sdzmitrovich
Date: 2008-09-10 09:59:51 -0400 (Wed, 10 Sep 2008)
New Revision: 10179
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1805/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1805/test.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1805Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1805
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1805/test.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1805/test.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1805/test.xhtml 2008-09-10
13:59:51 UTC (rev 10179)
@@ -0,0 +1,9 @@
+<!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>
+<span id="invisibleElement"> <f:converter /> </span>
+</body>
+</html>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-09-10
13:50:48 UTC (rev 10178)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-09-10
13:59:51 UTC (rev 10179)
@@ -25,6 +25,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1720Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1730Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1744Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1805Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2010Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2119Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2219Test;
@@ -94,6 +95,7 @@
suite.addTestSuite(JBIDE924Test.class);
suite.addTestSuite(JBIDE2526Test.class);
suite.addTestSuite(JBIDE2624.class);
+ suite.addTestSuite(JBIDE1805Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1805Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1805Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1805Test.java 2008-09-10
13:59:51 UTC (rev 10179)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class JBIDE1805Test extends VpeTest {
+
+ private static final String TEST_PAGE = "JBIDE/1805/test.xhtml";
//$NON-NLS-1$
+ private static final String ELEMENT_WRAPPER_ID = "invisibleElement";
//$NON-NLS-1$
+
+ public JBIDE1805Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE924() throws Throwable {
+
+ // get test page path
+ setException(null);
+
+ IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE,
+ JsfAllTests.IMPORT_PROJECT_NAME);
+
+ assertNotNull("Could not open specified file " + file.getFullPath(),
//$NON-NLS-1$
+ file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ VpeController vpeController = getVpeController(part);
+ assertNotNull(vpeController);
+
+ // set show invisible tag's flag to false
+ vpeController.getVisualBuilder().setShowInvisibleTags(false);
+ // refresh vpe
+ vpeController.visualRefresh();
+
+ TestUtil.waitForIdle();
+
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ assertNotNull(document);
+ // get element
+ nsIDOMElement element = document.getElementById(ELEMENT_WRAPPER_ID);
+ assertNotNull(element);
+ // element must have not children
+
+ assertEquals(0, countElementsChildren(element.getChildNodes()));
+
+ // set show invisible tag's flag to true
+ vpeController.getVisualBuilder().setShowInvisibleTags(true);
+ vpeController.visualRefresh();
+
+ TestUtil.waitForIdle();
+ document = getVpeVisualDocument(part);
+ assertNotNull(document);
+ // get element
+ element = document.getElementById(ELEMENT_WRAPPER_ID);
+
+ assertEquals(1, countElementsChildren(element.getChildNodes()));
+
+ if (getException() != null) {
+
+ throw getException();
+ }
+ }
+
+ private int countElementsChildren(nsIDOMNodeList list) {
+
+ int count = 0;
+ for (int i = 0; i < list.getLength(); i++) {
+ nsIDOMNode child = list.item(i);
+ if (child.getNodeType() == nsIDOMNode.ELEMENT_NODE)
+ count++;
+ }
+
+ return count;
+ }
+
+}