Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / addRange-failures.html
blob10af5ac6981f2563e26f35059ff5f0e88c1c80be
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>addRange failures</title>
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <script>
9 description('Test error handling of Selection.addRange().');
11 var selection = window.getSelection();
13 function testNull()
15 selection.addRange(null);
18 function testDetachedRange()
20 var range = new Range();
21 range.detach();
22 selection.addRange(range);
25 function testOtherDocument()
27 var iframe = document.createElement('iframe');
28 document.body.appendChild(iframe);
30 var range = iframe.contentDocument.createRange();
31 selection.addRange(range);
33 document.body.removeChild(iframe);
36 function testOtherDocumentFragments()
38 var shadowHost = document.createElement('div');
39 var shadowRoot = shadowHost.createShadowRoot();
40 document.body.appendChild(shadowHost);
42 var range = new Range();
43 range.selectNodeContents(shadowRoot);
44 selection.addRange(range);
46 document.body.removeChild(shadowHost);
49 function runSingleTest(testFunction)
51 selection.removeAllRanges();
52 var range = new Range();
53 range.setStart(document.body, 0);
54 range.setEnd(document.body, 0);
55 selection.addRange(range);
57 debug('Running: ' + testFunction.name);
58 testFunction(selection);
60 // Selection should stay at the same position.
61 shouldEvaluateTo('selection.rangeCount', 1);
62 shouldBeTrue('selection.getRangeAt(0).startContainer === document.body');
63 shouldEvaluateTo('selection.getRangeAt(0).startOffset', 0);
64 shouldBeTrue('selection.getRangeAt(0).endContainer === document.body');
65 shouldEvaluateTo('selection.getRangeAt(0).endOffset', 0);
68 var testFunctions = [testNull, testDetachedRange, testOtherDocument, testOtherDocumentFragments];
69 testFunctions.forEach(runSingleTest);
70 </script>
71 </body>
72 </html>