Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/assert_selection.html

Issue 2704443002: Selection API: extend() should operate DOM Ranges. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="assert_selection.js"></script> 4 <script src="assert_selection.js"></script>
5 <script> 5 <script>
6 function checked_assert_selection(input, command, output) { 6 function checked_assert_selection(input, command, output) {
7 try { 7 try {
8 assert_selection(input, command, output); 8 assert_selection(input, command, output);
9 } catch (exception) { 9 } catch (exception) {
10 return exception.message; 10 return exception.message;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 '<span id="jkl">jkl</span>', 158 '<span id="jkl">jkl</span>',
159 '<content select="#abc"></content>', 159 '<content select="#abc"></content>',
160 '<span id="mno">mno</span>', 160 '<span id="mno">mno</span>',
161 ].join(''); 161 ].join('');
162 selection.collapse(document.getElementById('abc'), 0); 162 selection.collapse(document.getElementById('abc'), 0);
163 selection.extend(document.getElementById('def'), 0); 163 selection.extend(document.getElementById('def'), 0);
164 }, 164 },
165 [ 165 [
166 '<div id="host">', 166 '<div id="host">',
167 '<span id="ghi">ghi</span>', 167 '<span id="ghi">ghi</span>',
168 '<b id="def">def</b>', 168 '<b id="def">|def</b>',
169 '<span id="jkl">jkl</span>', 169 '<span id="jkl">jkl</span>',
170 '<b id="abc">^abc|</b>', 170 '<b id="abc">^abc</b>',
171 '<span id="mno">mno</span>', 171 '<span id="mno">mno</span>',
172 '</div>', 172 '</div>',
173 ].join(''), 173 ].join(''),
174 {dumpAs: 'flattree'}), 'dump flat tree for shadow DOM V0'); 174 {dumpAs: 'flattree'}), 'dump flat tree for shadow DOM V0');
175 175
176 test(() => assert_selection( 176 test(() => assert_selection(
177 [ 177 [
178 '<div id="host">', 178 '<div id="host">',
179 '<b id="abc" slot="abc">abc</b>', 179 '<b id="abc" slot="abc">abc</b>',
180 '<b id="def" slot="def">def</b>', 180 '<b id="def" slot="def">def</b>',
181 '</div>', 181 '</div>',
182 ].join(''), 182 ].join(''),
183 selection => { 183 selection => {
184 const document = selection.document; 184 const document = selection.document;
185 const host = document.getElementById('host'); 185 const host = document.getElementById('host');
186 const shadowRoot = host.attachShadow({mode: 'open'}); 186 const shadowRoot = host.attachShadow({mode: 'open'});
187 shadowRoot.innerHTML = [ 187 shadowRoot.innerHTML = [
188 '<span id="ghi">ghi</span>', 188 '<span id="ghi">ghi</span>',
189 '<slot name="def"></slot>', 189 '<slot name="def"></slot>',
190 '<span id="jkl">jkl</span>', 190 '<span id="jkl">jkl</span>',
191 '<slot name="abc"></slot>', 191 '<slot name="abc"></slot>',
192 '<span id="mno">mno</span>', 192 '<span id="mno">mno</span>',
193 ].join(''); 193 ].join('');
194 selection.collapse(document.getElementById('abc'), 0); 194 selection.collapse(document.getElementById('abc'), 0);
195 selection.extend(document.getElementById('def'), 0); 195 selection.extend(document.getElementById('def'), 0);
196 }, 196 },
197 [ 197 [
198 '<div id="host">', 198 '<div id="host">',
199 '<span id="ghi">ghi</span>', 199 '<span id="ghi">ghi</span>',
200 '<b id="def" slot="def">def</b>', 200 '<b id="def" slot="def">|def</b>',
201 '<span id="jkl">jkl</span>', 201 '<span id="jkl">jkl</span>',
202 '<b id="abc" slot="abc">^abc|</b>', 202 '<b id="abc" slot="abc">^abc</b>',
203 '<span id="mno">mno</span>', 203 '<span id="mno">mno</span>',
204 '</div>', 204 '</div>',
205 ].join(''), 205 ].join(''),
206 {dumpAs: 'flattree'}), 'dump flat tree for shadow DOM V1'); 206 {dumpAs: 'flattree'}), 'dump flat tree for shadow DOM V1');
207 207
208 test(() => { 208 test(() => {
209 assert_equals(checked_assert_selection('fo|o', 'noop', 'fo|o'), 209 assert_equals(checked_assert_selection('fo|o', 'noop', 'fo|o'),
210 'no exception'); 210 'no exception');
211 }, 'no marker in output'); 211 }, 'no marker in output');
212 212
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 assert_equals(sample2.iframe_.parentNode, null, 307 assert_equals(sample2.iframe_.parentNode, null,
308 'removeSampleIfSucceeded: true'); 308 'removeSampleIfSucceeded: true');
309 309
310 const sample3 = assert_selection('abc', '', 'abc'); 310 const sample3 = assert_selection('abc', '', 'abc');
311 assert_equals(sample3.iframe_.parentNode, null, 'with default options'); 311 assert_equals(sample3.iframe_.parentNode, null, 'with default options');
312 312
313 const sample4 = assert_selection('abc', '', 'abc', 'description'); 313 const sample4 = assert_selection('abc', '', 'abc', 'description');
314 assert_equals(sample4.iframe_.parentNode, null, 'with description'); 314 assert_equals(sample4.iframe_.parentNode, null, 'with description');
315 }, 'removeSampleIfSucceeded'); 315 }, 'removeSampleIfSucceeded');
316 </script> 316 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698