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

Side by Side Diff: LayoutTests/fast/dom/characterdata-api-arguments.html

Issue 21542002: Make CharacterData::insertData() / deleteData() / replaceData() arguments mandatory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline fast/dom/characterdata-appendData-argument.html Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/characterdata-api-arguments-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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#interface-char acterdata" />
5 <script src="../js/resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <script>
9 description("Tests that the CharacterData API arguments are correctly validated. ");
10
11 var text = document.createTextNode("abcd");
12 shouldBeEqualToString("text.data", "abcd");
13 shouldBe("text.__proto__.__proto__", "CharacterData.prototype");
14
15 // appendData()
16 shouldNotThrow("text.appendData('efg')");
17 shouldBeEqualToString("text.data", "abcdefg");
18 shouldThrow("text.appendData()", "'TypeError: Not enough arguments'");
19 shouldBeEqualToString("text.data", "abcdefg");
20
21 // insertData()
22 text.data = "efg";
23 shouldNotThrow("text.insertData(0, 'abcd')");
24 shouldBeEqualToString("text.data", "abcdefg");
25 shouldThrow("text.insertData()", "'TypeError: Not enough arguments'");
26 shouldBeEqualToString("text.data", "abcdefg");
27 shouldThrow("text.insertData(0)", "'TypeError: Not enough arguments'");
28 shouldBeEqualToString("text.data", "abcdefg");
29 shouldThrow("text.insertData(999, 'test')", "'IndexSizeError: Index or size was negative, or greater than the allowed value.'"); // offset greater than length.
30 shouldBeEqualToString("text.data", "abcdefg");
31 shouldNotThrow("text.insertData(-4294967294, 'test')");
32 shouldBeEqualToString("text.data", "abtestcdefg");
33
34 // deleteData()
35 text.data = "abcdefg";
36 shouldNotThrow("text.deleteData(4, 3)");
37 shouldBeEqualToString("text.data", "abcd");
38 shouldThrow("text.deleteData()", "'TypeError: Not enough arguments'");
39 shouldBeEqualToString("text.data", "abcd");
40 shouldThrow("text.deleteData(0)", "'TypeError: Not enough arguments'");
41 shouldBeEqualToString("text.data", "abcd");
42 shouldThrow("text.deleteData(999, 3)", "'IndexSizeError: Index or size was negat ive, or greater than the allowed value.'"); // offset greater than length.
43 shouldBeEqualToString("text.data", "abcd");
44 shouldNotThrow("text.deleteData(-4294967294, 2)");
45 shouldBeEqualToString("text.data", "ab");
46 shouldNotThrow("text.deleteData(1, 999)"); // Length argument is too large, shou ld be adjusted.
47 shouldBeEqualToString("text.data", "a");
48
49 // ReplaceData()
50 text.data = "efg";
51 shouldNotThrow("text.replaceData(0, 0, 'abcd')");
52 shouldBeEqualToString("text.data", "abcdefg");
53 shouldThrow("text.replaceData()", "'TypeError: Not enough arguments'");
54 shouldBeEqualToString("text.data", "abcdefg");
55 shouldThrow("text.replaceData(0)", "'TypeError: Not enough arguments'");
56 shouldBeEqualToString("text.data", "abcdefg");
57 shouldThrow("text.replaceData(0, 0)", "'TypeError: Not enough arguments'");
58 shouldBeEqualToString("text.data", "abcdefg");
59 shouldThrow("text.replaceData(999, 3, 'test')", "'IndexSizeError: Index or size was negative, or greater than the allowed value.'"); // offset greater than leng th.
60 shouldBeEqualToString("text.data", "abcdefg");
61 shouldNotThrow("text.replaceData(-4294967294, 0, 'test')");
62 shouldBeEqualToString("text.data", "abtestcdefg");
63 shouldNotThrow("text.replaceData(1, 999, 'aaa')"); // Length argument is too lar ge, should be adjusted.
64 shouldBeEqualToString("text.data", "aaaa");
65 </script>
66 <script src="../js/resources/js-test-post.js"></script>
67 </body>
68 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/characterdata-api-arguments-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698