Align Selection API with the specification
[WebKit-https.git] / LayoutTests / editing / selection / bad-input.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script>
6 description("Tests passing bad input to the Selection API.");
7
8 var selection = getSelection();
9
10 debug("* Not passing enough parameters");
11 shouldThrowErrorName("selection.collapse()", "TypeError");
12 shouldThrowErrorName("selection.containsNode()", "TypeError");
13 shouldThrowErrorName("selection.selectAllChildren()", "TypeError");
14 shouldThrowErrorName("selection.extend()", "TypeError");
15 shouldThrowErrorName("selection.getRangeAt()", "TypeError");
16 shouldThrowErrorName("selection.addRange()", "TypeError");
17 shouldThrowErrorName("selection.setBaseAndExtent()", "TypeError");
18 shouldThrowErrorName("selection.setBaseAndExtent(document.body)", "TypeError");
19 shouldThrowErrorName("selection.setBaseAndExtent(document.body, 0)", "TypeError");
20 shouldThrowErrorName("selection.setBaseAndExtent(document.body, 0, document.body)", "TypeError");
21 shouldThrowErrorName("selection.setPosition()", "TypeError");
22
23 debug("");
24 debug("* Passing null for non-nullable parameters");
25 shouldThrowErrorName("selection.containsNode(null)", "TypeError");
26 shouldThrowErrorName("selection.selectAllChildren(null)", "TypeError");
27 shouldThrowErrorName("selection.extend(null)", "TypeError");
28 shouldThrowErrorName("selection.addRange(null)", "TypeError");
29 debug("");
30 </script> 
31 <script src="../../resources/js-test-post.js"></script>
32 </body>
33 </html>