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

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

Issue 163883006: Add context to generated named and indexed property operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. Created 6 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 | 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 var d = document.createElement("div"); 82 var d = document.createElement("div");
83 d.dataset[prop] = "value"; 83 d.dataset[prop] = "value";
84 return d.getAttribute(attr) === null; 84 return d.getAttribute(attr) === null;
85 } 85 }
86 86
87 shouldBeTrue("testIsNull('0123', 'data-123')"); 87 shouldBeTrue("testIsNull('0123', 'data-123')");
88 shouldBeTrue("testIsNull('123', 'data-0123')"); 88 shouldBeTrue("testIsNull('123', 'data-0123')");
89 debug(""); 89 debug("");
90 90
91 shouldThrow("testSet('-foo', 'dummy')", '"SyntaxError: Failed to set the \'-foo\ ' property on \'DOMStringMap\': \'-foo\' is not a valid property name."'); 91 shouldThrow("testSet('-foo', 'dummy')", '"SyntaxError: Failed to set the \'-foo\ ' property on \'DOMStringMap\': \'-foo\' is not a valid property name."');
92 shouldThrow("testSet('foo\x20', 'dummy')", '"InvalidCharacterError: \'data-foo\x 20\' is not a valid attribute name."'); 92 shouldThrow("testSet('foo\x20', 'dummy')", '"InvalidCharacterError: Failed to se t the \'foo\x20\' property on \'DOMStringMap\': \'data-foo\x20\' is not a valid attribute name."');
93 shouldThrow("testSet('foo\uF900', 'dummy')", '"InvalidCharacterError: \'data-foo \uF900\' is not a valid attribute name."'); 93 shouldThrow("testSet('foo\uF900', 'dummy')", '"InvalidCharacterError: Failed to set the \'foo\uF900\' property on \'DOMStringMap\': \'data-foo\uF900\' is not a valid attribute name."');
94 debug(""); 94 debug("");
95 95
96 function testDelete(attr, prop) 96 function testDelete(attr, prop)
97 { 97 {
98 var d = document.createElement("div"); 98 var d = document.createElement("div");
99 d.setAttribute(attr, "value"); 99 d.setAttribute(attr, "value");
100 delete d.dataset[prop]; 100 delete d.dataset[prop];
101 return d.getAttribute(attr) != "value"; 101 return d.getAttribute(attr) != "value";
102 } 102 }
103 103
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 shouldBe("div.getAttribute('data-a-500k')", "'updated'"); 210 shouldBe("div.getAttribute('data-a-500k')", "'updated'");
211 211
212 debug(""); 212 debug("");
213 debug("Set null:"); 213 debug("Set null:");
214 214
215 var d = document.createElement("div"); 215 var d = document.createElement("div");
216 d.dataset.foo = null; 216 d.dataset.foo = null;
217 shouldBe("d.dataset.foo", "'null'"); 217 shouldBe("d.dataset.foo", "'null'");
218 218
219 debug(""); 219 debug("");
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/dataset-xhtml-expected.txt ('k') | LayoutTests/fast/dom/script-tests/dataset-xhtml.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698