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

Side by Side Diff: LayoutTests/fast/dom/custom/document-register-type-extensions.html

Issue 117313008: Update Custom Elements API to new names. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for forgotten tests. Created 7 years 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="container"></div> 7 <div id="container"></div>
8 <form id="testForm"></form> 8 <form id="testForm"></form>
9 <script> 9 <script>
10 description('Testing document.register() type extension behaviours through creat eElement().'); 10 description('Testing document.registerElement() type extension behaviours throug h createElement().');
11 11
12 function isFormControl(element) 12 function isFormControl(element)
13 { 13 {
14 testForm.appendChild(element); 14 testForm.appendChild(element);
15 return element.form == testForm; 15 return element.form == testForm;
16 } 16 }
17 17
18 if (window.testRunner) 18 if (window.testRunner)
19 testRunner.dumpAsText(); 19 testRunner.dumpAsText();
20 20
21 // 21 //
22 // Inheritance here is shaped like this: 22 // Inheritance here is shaped like this:
23 // 23 //
24 // HTMLElement <- input <- x-bar <- x-qux 24 // HTMLElement <- input <- x-bar <- x-qux
25 // <- x-foo <- x-baz 25 // <- x-foo <- x-baz
26 // 26 //
27 27
28 fooConstructor = document.register('x-foo', { prototype: Object.create(HTMLEleme nt.prototype) }); 28 fooConstructor = document.registerElement('x-foo', { prototype: Object.create(HT MLElement.prototype) });
29 barConstructor = document.register('x-bar', { extends: 'input', prototype: Objec t.create(HTMLInputElement.prototype) }); 29 barConstructor = document.registerElement('x-bar', { extends: 'input', prototype : Object.create(HTMLInputElement.prototype) });
30 bazConstructor = document.register('x-baz', { prototype: Object.create(fooConstr uctor.prototype) }); 30 bazConstructor = document.registerElement('x-baz', { prototype: Object.create(fo oConstructor.prototype) });
31 quxConstructor = document.register('x-qux', { extends: 'input', prototype: Objec t.create(barConstructor.prototype) }); 31 quxConstructor = document.registerElement('x-qux', { extends: 'input', prototype : Object.create(barConstructor.prototype) });
32 32
33 // Same name, different local name 33 // Same name, different local name
34 shouldThrow('document.register("x-foo", { prototype: Object.create(HTMLDivElemen t.prototype) })', '"InvalidStateError: Failed to execute \'register\' on \'Docum ent\': Registration failed for type \'x-foo\'. A type with that name is already registered."'); 34 shouldThrow('document.registerElement("x-foo", { prototype: Object.create(HTMLDi vElement.prototype) })', '"InvalidStateError: Failed to execute \'registerElemen t\' on \'Document\': Registration failed for type \'x-foo\'. A type with that na me is already registered."');
35 35
36 // 36 //
37 // Generated constructors 37 // Generated constructors
38 // 38 //
39 39
40 fooNewed = new fooConstructor(); 40 fooNewed = new fooConstructor();
41 fooOuterHTML = '<x-foo></x-foo>'; 41 fooOuterHTML = '<x-foo></x-foo>';
42 shouldBeEqualToString('fooNewed.outerHTML', fooOuterHTML); 42 shouldBeEqualToString('fooNewed.outerHTML', fooOuterHTML);
43 shouldBeTrue('fooNewed instanceof fooConstructor && fooNewed instanceof HTMLElem ent'); 43 shouldBeTrue('fooNewed instanceof fooConstructor && fooNewed instanceof HTMLElem ent');
44 shouldBeFalse('fooNewed instanceof HTMLUnknownElement'); 44 shouldBeFalse('fooNewed instanceof HTMLUnknownElement');
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 shouldBeFalse('namedBarParsed instanceof HTMLUnknownElement'); 163 shouldBeFalse('namedBarParsed instanceof HTMLUnknownElement');
164 shouldBeTrue('namedBarParsed instanceof HTMLElement'); 164 shouldBeTrue('namedBarParsed instanceof HTMLElement');
165 165
166 divBarParsed = createElementFromHTML('<div is="x-bar">') 166 divBarParsed = createElementFromHTML('<div is="x-bar">')
167 shouldBeFalse('divBarParsed instanceof barConstructor'); 167 shouldBeFalse('divBarParsed instanceof barConstructor');
168 shouldBeTrue('divBarParsed instanceof HTMLDivElement'); 168 shouldBeTrue('divBarParsed instanceof HTMLDivElement');
169 169
170 </script> 170 </script>
171 </body> 171 </body>
172 </html> 172 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698