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

Side by Side Diff: LayoutTests/fast/dom/script-tests/dataset.js

Issue 16818023: DOMException toString is not correct (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 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
OLDNEW
1 description("This tests element.dataset."); 1 description("This tests element.dataset.");
2 2
3 function testGet(attr, expected) 3 function testGet(attr, expected)
4 { 4 {
5 var d = document.createElement("div"); 5 var d = document.createElement("div");
6 d.setAttribute(attr, "value"); 6 d.setAttribute(attr, "value");
7 return d.dataset[expected] == "value"; 7 return d.dataset[expected] == "value";
8 } 8 }
9 9
10 shouldBeTrue("testGet('data-foo', 'foo')"); 10 shouldBeTrue("testGet('data-foo', 'foo')");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 shouldBeTrue("testSet('foo', 'data-foo')"); 46 shouldBeTrue("testSet('foo', 'data-foo')");
47 shouldBeTrue("testSet('fooBar', 'data-foo-bar')"); 47 shouldBeTrue("testSet('fooBar', 'data-foo-bar')");
48 shouldBeTrue("testSet('-', 'data--')"); 48 shouldBeTrue("testSet('-', 'data--')");
49 shouldBeTrue("testSet('Foo', 'data--foo')"); 49 shouldBeTrue("testSet('Foo', 'data--foo')");
50 shouldBeTrue("testSet('-Foo', 'data---foo')"); 50 shouldBeTrue("testSet('-Foo', 'data---foo')");
51 shouldBeTrue("testSet('', 'data-')"); 51 shouldBeTrue("testSet('', 'data-')");
52 shouldBeTrue("testSet('\xE0', 'data-\xE0')"); 52 shouldBeTrue("testSet('\xE0', 'data-\xE0')");
53 debug(""); 53 debug("");
54 54
55 shouldThrow("testSet('-foo', 'dummy')", "'Error: SyntaxError: DOM Exception 12'" ); 55 shouldThrow("testSet('-foo', 'dummy')", "'SyntaxError: An invalid or illegal str ing was specified.'");
56 shouldThrow("testSet('foo\x20', 'dummy')", "'Error: InvalidCharacterError: DOM E xception 5'"); 56 shouldThrow("testSet('foo\x20', 'dummy')", "'InvalidCharacterError: An invalid o r illegal character was specified, such as in an XML name.'");
57 shouldThrow("testSet('foo\uF900', 'dummy')", "'Error: InvalidCharacterError: DOM Exception 5'"); 57 shouldThrow("testSet('foo\uF900', 'dummy')", "'InvalidCharacterError: An invalid or illegal character was specified, such as in an XML name.'");
58 debug(""); 58 debug("");
59 59
60 function testDelete(attr, prop) 60 function testDelete(attr, prop)
61 { 61 {
62 var d = document.createElement("div"); 62 var d = document.createElement("div");
63 d.setAttribute(attr, "value"); 63 d.setAttribute(attr, "value");
64 delete d.dataset[prop]; 64 delete d.dataset[prop];
65 return d.getAttribute(attr) != "value"; 65 return d.getAttribute(attr) != "value";
66 } 66 }
67 67
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 shouldBeUndefined("delete div.dataset.Bar; div.dataset.Bar"); 123 shouldBeUndefined("delete div.dataset.Bar; div.dataset.Bar");
124 124
125 debug(""); 125 debug("");
126 debug("Set null:"); 126 debug("Set null:");
127 127
128 var d = document.createElement("div"); 128 var d = document.createElement("div");
129 d.dataset.foo = null; 129 d.dataset.foo = null;
130 shouldBe("d.dataset.foo", "'null'"); 130 shouldBe("d.dataset.foo", "'null'");
131 131
132 debug(""); 132 debug("");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698