| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.test.wysiwyg; |
| 21 |
|
|
| 22 |
|
import org.junit.Test; |
| 23 |
|
import org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase; |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@version |
| 29 |
|
@since |
| 30 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 4 |
Complexity Density: 0.2 |
|
| 31 |
|
public class ImportTest extends AbstractWysiwygTestCase |
| 32 |
|
{ |
| 33 |
|
public static final String IMPORT_BUTTON = "Import"; |
| 34 |
|
|
| 35 |
|
public static final String FILTER_STYLES = "//div[@class = 'xDialogBody']//input[@type = 'checkbox']"; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 40 |
1 |
@Test... |
| 41 |
|
public void testPasteFromClipboard() |
| 42 |
|
{ |
| 43 |
1 |
clickPasteButton(); |
| 44 |
1 |
populateOfficeContentEditor("<p>Hello <font color=\"#ff0000\">World</font></p>"); |
| 45 |
1 |
getSelenium().uncheck(FILTER_STYLES); |
| 46 |
1 |
clickButtonWithText(IMPORT_BUTTON); |
| 47 |
1 |
waitForDialogToClose(); |
| 48 |
1 |
switchToSource(); |
| 49 |
1 |
assertSourceText("Hello (% style=\"color:#ff0000;\" %)World"); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
@see |
| 54 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 55 |
1 |
@Test... |
| 56 |
|
public void testPastedContentIsPreservedWhenDialogIsMoved() |
| 57 |
|
{ |
| 58 |
1 |
clickPasteButton(); |
| 59 |
|
|
| 60 |
1 |
populateOfficeContentEditor("office"); |
| 61 |
|
|
| 62 |
1 |
getSelenium().dragdrop("//div[@class='gwt-Label xDialogCaption']", "100, 100"); |
| 63 |
|
|
| 64 |
1 |
clickButtonWithText(IMPORT_BUTTON); |
| 65 |
1 |
waitForDialogToClose(); |
| 66 |
|
|
| 67 |
1 |
switchToSource(); |
| 68 |
1 |
assertSourceText("office"); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 74 |
2 |
protected void clickPasteButton()... |
| 75 |
|
{ |
| 76 |
2 |
pushToolBarButton("Paste"); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
@param |
| 83 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 84 |
2 |
private void populateOfficeContentEditor(String innerHTML)... |
| 85 |
|
{ |
| 86 |
2 |
StringBuilder script = new StringBuilder(); |
| 87 |
2 |
script.append("var eframe = document.getElementsByClassName('xImportOfficeContentEditor')[0];\n"); |
| 88 |
2 |
script.append("var rte = eframe.contentWindow.document.body;\n"); |
| 89 |
2 |
script.append(String.format("rte.innerHTML = '%s';\n", innerHTML)); |
| 90 |
2 |
getSelenium().getEval(script.toString()); |
| 91 |
|
} |
| 92 |
|
} |