|
18 | 18 | <script class="testbody" type="application/javascript">
|
19 | 19 | SimpleTest.waitForExplicitFinish();
|
20 | 20 | SimpleTest.waitForFocus(function() {
|
| 21 | + const isTraditionalSplitDirection =!SpecialPowers.getBoolPref( |
| 22 | + "editor.join_split_direction.compatible_with_the_other_browsers" |
| 23 | + ); |
| 24 | + |
21 | 25 | var editor = document.getElementById("editor");
|
22 | 26 | editor.focus();
|
23 | 27 |
|
|
37 | 41 | "#01-01 At typing something after setting some styles, should cause inserting some nodes to apply the style");
|
38 | 42 |
|
39 | 43 | // #01-02 Typing something after removing some characters after setting some styles should work as without removing some character.
|
40 |
| - // XXX This behavior is different from Chromium. |
41 | 44 | editor.innerHTML = "beforeafter";
|
42 | 45 | selection.collapse(editor.firstChild, "before".length);
|
43 | 46 | document.execCommand("bold");
|
|
46 | 49 | synthesizeKey("KEY_Delete");
|
47 | 50 | sendString("test");
|
48 | 51 |
|
49 |
| - is(editor.innerHTML, "before<strike><i><b>test</b></i></strike>fter", |
50 |
| - "#01-02-1 At typing something after Delete after setting style, should cause inserting some nodes to apply the style"); |
| 52 | + todo_is( |
| 53 | + editor.innerHTML, |
| 54 | + "beforetestfter", |
| 55 | + "#01-02-1 At typing something after Delete after setting style, the style should not be preserved for compatibility with the other browsers" |
| 56 | + ); |
| 57 | + is( |
| 58 | + editor.innerHTML, |
| 59 | + "before<strike><i><b>test</b></i></strike>fter", |
| 60 | + "#01-02-1 At typing something after Delete after setting style, the style should not be preserved, but it's okay to do it for backward compatibility" |
| 61 | + ); |
51 | 62 |
|
52 | 63 | editor.innerHTML = "beforeafter";
|
53 | 64 | selection.collapse(editor.firstChild, "before".length);
|
|
84 | 95 | "#01-03-2 Typing Enter after setting style should not ignore the styles");
|
85 | 96 |
|
86 | 97 | // #02-01 Replacing text with typing some text after setting some styles should work as just inserting text.
|
87 |
| - // XXX Chromium works as expected. |
88 | 98 | editor.innerHTML = "beforeselectionafter";
|
89 | 99 | selection.collapse(editor.firstChild, "before".length);
|
90 | 100 | selection.extend(editor.firstChild, "beforeselection".length);
|
|
93 | 103 | document.execCommand("strikethrough");
|
94 | 104 | sendString("test");
|
95 | 105 |
|
96 |
| - is(editor.innerHTML, "before<strike><i><b>test</b></i></strike>after", |
97 |
| - "#02-01 At replacing \"selection\" after setting some styles, should keep the styles at inserting text"); |
| 106 | + todo_is( |
| 107 | + editor.innerHTML, |
| 108 | + "before<b><i><strike>test</strike></i></b>after", |
| 109 | + "#02-01 At replacing \"selection\" after setting some styles, should keep the styles at inserting text for compatibility with the other browsers" |
| 110 | + ); |
| 111 | + is( |
| 112 | + editor.innerHTML, |
| 113 | + "before<strike><i><b>test</b></i></strike>after", |
| 114 | + "#02-01 At replacing \"selection\" after setting some styles, should keep the styles at inserting text, but it's okay to do it with reverted order for the backward compatibility" |
| 115 | + ); |
98 | 116 |
|
99 | 117 | // #02-02 Inserting text after removing selected text after setting some styles should not keep the styles.
|
100 |
| - // XXX Chromium keeps the style. |
101 | 118 | editor.innerHTML = "beforeselectionafter";
|
102 | 119 | selection.collapse(editor.firstChild, "before".length);
|
103 | 120 | selection.extend(editor.firstChild, "beforeselection".length);
|
|
107 | 124 | synthesizeKey("KEY_Backspace");
|
108 | 125 | sendString("test");
|
109 | 126 |
|
110 |
| - is(editor.innerHTML, "beforetestafter", |
111 |
| - "#02-02 After removing \"selection\" after setting some styles, should not keep the styles"); |
| 127 | + todo_is( |
| 128 | + editor.innerHTML, |
| 129 | + "before<b><i><strike>test</strike></i></b>after", |
| 130 | + "#02-02 After removing \"selection\" after setting some styles, should preserve the style for compatibility with the other browsers" |
| 131 | + ); |
| 132 | + if (isTraditionalSplitDirection) { |
| 133 | + is( |
| 134 | + editor.innerHTML, |
| 135 | + "beforetestafter", |
| 136 | + "#02-02 After removing \"selection\" after setting some styles, should preserve the style, but it's okay not to do it for backward compatibility" |
| 137 | + ); |
| 138 | + } else { |
| 139 | + is( |
| 140 | + editor.innerHTML, |
| 141 | + "before<strike><i><b>test</b></i></strike>after", |
| 142 | + "#02-02 After removing \"selection\" after setting some styles, should preserve the style, but it's okay to do it with reverted order for the backward compatibility" |
| 143 | + ); |
| 144 | + } |
112 | 145 |
|
113 | 146 | // #02-03 Inserting text after replacing selected text after setting some styles should keep the styles.
|
114 | 147 | editor.innerHTML = "beforeselectionafter";
|
|
120 | 153 | synthesizeKey("KEY_Enter");
|
121 | 154 | sendString("test");
|
122 | 155 |
|
123 |
| - is(editor.innerHTML, "<div>before</div><div><strike><i><b>test</b></i></strike>after</div>", |
124 |
| - "#02-03-1 Typing Enter after setting style to selected text should keep the styles"); |
| 156 | + todo_is( |
| 157 | + editor.innerHTML, |
| 158 | + "before<div><b><i><strike>test</strike></i></b>after</div>", |
| 159 | + "#02-03-1 Typing Enter after setting style to selected text should keep the styles and insert text into the new paragraph" |
| 160 | + ); |
| 161 | + if (isTraditionalSplitDirection) { |
| 162 | + is( |
| 163 | + editor.innerHTML, |
| 164 | + "<div>before</div><div><strike><i><b>test</b></i></strike>after</div>", |
| 165 | + "#02-03-1 Typing Enter after setting style to selected text should keep the styles, it's okay to create left paragraph for backward compatibility" |
| 166 | + ); |
| 167 | + } else { |
| 168 | + is( |
| 169 | + editor.innerHTML, |
| 170 | + "<div>before</div><div><strike><i><b>test</b></i></strike>after</div>", |
| 171 | + "#02-03-1 Typing Enter after setting style to selected text should keep the styles, it's okay to create left paragraph for backward compatibility" |
| 172 | + ); |
| 173 | + } |
125 | 174 |
|
126 | 175 | editor.innerHTML = "<p>beforeselectionafter</p>";
|
127 | 176 | selection.collapse(editor.firstChild.firstChild, "before".length);
|
|
132 | 181 | synthesizeKey("KEY_Enter");
|
133 | 182 | sendString("test");
|
134 | 183 |
|
135 |
| - is(editor.innerHTML, "<p>before</p><p><strike><i><b>test</b></i></strike>after</p>", |
136 |
| - "#02-03-2 Typing Enter after setting style to selected text should keep the styles"); |
| 184 | + is( |
| 185 | + editor.innerHTML, |
| 186 | + "<p>before</p><p><strike><i><b>test</b></i></strike>after</p>", |
| 187 | + "#02-03-2 Typing Enter after setting style to selected text should keep the styles" |
| 188 | + ); |
137 | 189 |
|
138 | 190 | // #03-01 Replacing in <b style="font-weight: normal;"> shouldn't cause new <b>.
|
139 | 191 | editor.innerHTML = "<b style=\"font-weight: normal;\">beforeselectionafter</b>";
|
|
0 commit comments