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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/spec/define-element.html

Issue 2320553002: Custom Elements: HTMLElement constructor tests (Closed)
Patch Set: wraping up long stringl literal Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/custom-elements/spec/construct.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Custom Elements: defineElement</title> 2 <title>Custom Elements: defineElement</title>
3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#cus tomelementsregistry"> 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#cus tomelementsregistry">
4 <meta name="author" title="Dominic Cooney" href="mailto:dominicc@chromium.org"> 4 <meta name="author" title="Dominic Cooney" href="mailto:dominicc@chromium.org">
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="resources/custom-elements-helpers.js"></script> 7 <script src="resources/custom-elements-helpers.js"></script>
8 <body> 8 <body>
9 <script> 9 <script>
10 // TODO(dominicc): Merge these tests with 10 // TODO(dominicc): Merge these tests with
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // attributeChangedCallback is undefined. 365 // attributeChangedCallback is undefined.
366 test_with_window((w) => { 366 test_with_window((w) => {
367 let observedAttributes_invoked = false; 367 let observedAttributes_invoked = false;
368 let X = (function () {}).bind({}); 368 let X = (function () {}).bind({});
369 Object.defineProperty(X, 'observedAttributes', { 369 Object.defineProperty(X, 'observedAttributes', {
370 get() { observedAttributes_invoked = true; } 370 get() { observedAttributes_invoked = true; }
371 }); 371 });
372 assert_false( observedAttributes_invoked, 'Get(constructor, observedAttributes ) should not be invoked'); 372 assert_false( observedAttributes_invoked, 'Get(constructor, observedAttributes ) should not be invoked');
373 }, 'Get(constructor, observedAttributes) should not execute if ' + 373 }, 'Get(constructor, observedAttributes) should not execute if ' +
374 'attributeChangedCallback is undefined'); 374 'attributeChangedCallback is undefined');
375
376 // TODO(dominicc): I think the order and timing of checks the tests
377 // below exercise has changed. Update these tests. crbug.com/643052
378
379 // step 2
380 // 2. If constructor is an interface object whose corresponding interface either is
381 // HTMLElement or has HTMLElement in its set of inherited interfaces, throw
382 // a TypeError and abort these steps.
383 // 3. If name is not a valid custom element name, then throw a "SyntaxError" DOM Exception
384 // and abort these steps.
385 test_with_window((w) => {
386 let invalid_name = 'annotation-xml';
387 // TODO(davaajav): change this to TypeError, when we add a failure expectation to this file
388 assert_throws_dom_exception(w, 'SYNTAX_ERR', () => {
389 w.customElements.define(invalid_name, HTMLElement);
390 }, 'defining a constructor that is an interface object whose interface is HTML Element' +
391 'should throw TypeError not SyntaxError');
392 }, 'Invalid constructor');
393
394 // step 2
395 test_with_window((w) => {
396 let invalid_name = 'annotation-xml';
397 assert_throws_dom_exception(w, 'SYNTAX_ERR', () => {
398 w.customElements.define(invalid_name, HTMLButtonElement);
399 }, 'defining a constructor that is an interface object who has HTMLElement' +
400 'in its set of inhertied interfaces should throw TypeError not SyntaxError' );
401 }, 'Invalid constructor');
402
403 // step 2
404 test_with_window((w) => {
405 let invalid_name = 'annotation-xml';
406 assert_throws_dom_exception(w, 'SYNTAX_ERR', () => {
407 w.customElements.define(invalid_name, class extends HTMLElement {});
408 }, 'defining author-defined custom element constructor should pass this ' +
409 'step without throwing TypeError');
410 }, 'Invalid constructor');
411 </script> 375 </script>
412 </body> 376 </body>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/custom-elements/spec/construct.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698