Skip to content

Commit

Permalink
Bug 1557368 [wpt PR 16856] - Update error type test for attachInterna…
Browse files Browse the repository at this point in the history
…ls(), a=testonly

Automatic update from web-platform-tests
Update error type test for attachInternals() (#16856)

Follows latest developments in whatwg/html#4324.
--

wp5At-commits: dc4519e0a9b6a0b5f53e622a31b420cb22d3a100
wpt-pr: 16856
  • Loading branch information
domenic authored and jgraham committed Jun 19, 2019
1 parent 5054d1a commit 5022688
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
let element = new MyElement1();
assert_true(element.attachInternals() instanceof ElementInternals,
'New - 1st call');
assert_throws('InvalidStateError', () => { element.attachInternals(); },
assert_throws('NotSupportedError', () => { element.attachInternals(); },
'New - 2nd call');

element = document.createElement('my-element1');
assert_true(element.attachInternals() instanceof ElementInternals,
'createElement - 1st call');
assert_throws('InvalidStateError', () => { element.attachInternals(); },
assert_throws('NotSupportedError', () => { element.attachInternals(); },
'createElement - 2nd call');

container.innerHTML = '<my-element1></my-element1>';
assert_true(container.firstChild.attachInternals() instanceof ElementInternals,
'Parser - 1st call');
assert_throws('InvalidStateError', () => {
assert_throws('NotSupportedError', () => {
container.firstChild.attachInternals();
}, 'Parser - 2nd call');
}, 'Successful attachInternals() and the second call.');
Expand All @@ -41,17 +41,17 @@

test(() => {
const builtin = document.createElement('div');
assert_throws('InvalidStateError', () => { builtin.attachInternals() });
assert_throws('NotSupportedError', () => { builtin.attachInternals() });

const doc = document.implementation.createDocument('foo', null);
const span = doc.appendChild(doc.createElementNS('http://www.w3.org/1999/xhtml', 'html:span'));
assert_true(span instanceof HTMLElement);
assert_throws('InvalidStateError', () => { span.attachInternals(); });
assert_throws('NotSupportedError', () => { span.attachInternals(); });

const undefinedCustom = document.createElement('undefined-element');
assert_throws('InvalidStateError', () => { undefinedCustom.attachInternals() });
assert_throws('NotSupportedError', () => { undefinedCustom.attachInternals() });
}, 'If a custom element definition for the local name of the element doesn\'t' +
' exist, throw an InvalidStateError');
' exist, throw an NotSupportedError');

test(() => {
class MyElement2 extends HTMLElement {
Expand Down

0 comments on commit 5022688

Please sign in to comment.