On Feb 2, 2009, at 12:56 PM, mflorea (SVN) wrote:
Author: mflorea Date: 2009-02-02 12:56:41 +0100 (Mon, 02 Feb 2009) New Revision: 16027
Modified: enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/ xpn/xwiki/it/selenium/StandardFeaturesTest.java Log: XWIKI-3053: When a HR is inserted at the beginning of a paragraph an extra empty paragraph is generated before that HR
Modified: enterprise/trunk/distribution-test/wysiwyg-tests/src/test/ it/com/xpn/xwiki/it/selenium/StandardFeaturesTest.java =================================================================== --- enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/ xpn/xwiki/it/selenium/StandardFeaturesTest.java 2009-02-02 11:52:59 UTC (rev 16026) +++ enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/ xpn/xwiki/it/selenium/StandardFeaturesTest.java 2009-02-02 11:56:41 UTC (rev 16027) @@ -613,4 +613,35 @@ switchToWikiEditor(); assertEquals("before\n\n|=Space|=Page\n|Main|WebHome\n \nafter", getFieldValue("content")); } + + /** + * @see XWIKI-3053: When a HR is inserted at the beginning of a paragraph an extra empty paragraph is generated + * before that HR + */ + public void testInsertHRInsideParagraph() + { + typeText("xy"); + applyStyleParagraph(); + + // Insert HR at the end of the paragraph. + clickHRButton(); + + // More the caret between x and y. + runScript("var range = XWE.selection.getRangeAt(0);\n" + "range.setStart(XWE.body.firstChild.firstChild, 1);\n" + + "range.collapse(true);");
Is there a way move to this to a DSL method for moving the caret?
+ + // Insert HR in the middle of the paragraph. + clickHRButton(); + + // Move the caret before x. + runScript("var range = XWE.selection.getRangeAt(0);\n" + "range.setStart(XWE.body.firstChild.firstChild, 0);\n" + + "range.collapse(true);"); + + // Insert HR at the beginning of the paragraph. + clickHRButton(); + + // We have to assert the XHTML because the arrow keys don't move the caret so we can't test if the user can edit + // the generated empty paragraphs. The fact that they contain a BR proves this. + assertXHTML("<p><br class=\"emptyLine\"></p><hr><p>x</ p><hr><p>y</p><hr><p><br class=\"emptyLine\"></p>"); + } }
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net