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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js

Issue 2700673005: selection: Do not run invalid sub-tests with unselectable Range. (Closed)
Patch Set: . 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/external/wpt/selection/addRange-00-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 "use strict"; 1 "use strict";
2 2
3 function testAddRange(exception, range, endpoints, qualifier, testName) { 3 function testAddRange(exception, range, endpoints, qualifier, testName) {
4 if (!isSelectableNode(endpoints[0]) || !isSelectableNode(endpoints[2])) {
5 test(function() {
6 assert_equals(exception, null, "Test setup must not throw exceptions ");
7
8 assertSelectionNoChange(function() { selection.addRange(range); });
9 assert_equals(range.startContainer, endpoints[0],
10 "addRange() must not modify the startContainer of the Range it's given");
11 assert_equals(range.startOffset, endpoints[1],
12 "addRange() must not modify the startOffset of the Range it's gi ven");
13 assert_equals(range.endContainer, endpoints[2],
14 "addRange() must not modify the endContainer of the Range it's g iven");
15 assert_equals(range.endOffset, endpoints[3],
16 "addRange() must not modify the endOffset of the Range it's give n");
17 }, testName + ": " + qualifier + " addRange() must do nothing");
18 return;
19 }
20
4 test(function() { 21 test(function() {
5 assert_equals(exception, null, "Test setup must not throw exceptions"); 22 assert_equals(exception, null, "Test setup must not throw exceptions");
6 23
7 selection.addRange(range); 24 selection.addRange(range);
8 25
9 assert_equals(range.startContainer, endpoints[0], 26 assert_equals(range.startContainer, endpoints[0],
10 "addRange() must not modify the startContainer of the Range it's giv en"); 27 "addRange() must not modify the startContainer of the Range it's giv en");
11 assert_equals(range.startOffset, endpoints[1], 28 assert_equals(range.startOffset, endpoints[1],
12 "addRange() must not modify the startOffset of the Range it's given" ); 29 "addRange() must not modify the startOffset of the Range it's given" );
13 assert_equals(range.endContainer, endpoints[2], 30 assert_equals(range.endContainer, endpoints[2],
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 throw "Sanity check: the second Range we created must have t he desired endContainer"; 186 throw "Sanity check: the second Range we created must have t he desired endContainer";
170 } 187 }
171 if (range2.endOffset !== endpoints2[3]) { 188 if (range2.endOffset !== endpoints2[3]) {
172 throw "Sanity check: the second Range we created must have t he desired endOffset"; 189 throw "Sanity check: the second Range we created must have t he desired endOffset";
173 } 190 }
174 } catch (e) { 191 } catch (e) {
175 exception = e; 192 exception = e;
176 } 193 }
177 194
178 testAddRange(exception, range1, endpoints1, "first", testName); 195 testAddRange(exception, range1, endpoints1, "first", testName);
179 testAddRange(exception, range2, endpoints2, "second", testName); 196 if (selection.rangeCount > 0)
197 testAddRange(exception, range2, endpoints2, "second", testName);
180 } 198 }
181 } 199 }
182 } 200 }
183 201
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/selection/addRange-00-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698