Skip to content

Commit

Permalink
test: test setting innerHTML, outerHTML on host will throw
Browse files Browse the repository at this point in the history
fixed in #1001
  • Loading branch information
ravijayaramappa committed Jan 14, 2020
1 parent 0fc5937 commit 2a411c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ describe('Element.innerHTML - get', () => {
});

describe('Element.innerHTML - set', () => {
// TODO [#990]: No error is thrown when invoking innerHTML on the host element
xit('should throw when invoking setter on the host element', () => {
it('should throw when invoking setter on the host element', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);

expect(() => {
elm.innerHTML = '<span>Hello World!</span>';
}).toThrowError();
}).toThrowError(TypeError);
});

it('should log an error when invoking setter for an element in the shadow', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,22 @@ describe('Element.outerHTML - get', () => {
});

describe('Element.outerHTML - set', () => {
// TODO [#991]: Add error type to the .toThrowError(<type>) matcher once the issue is fixed.
xit('should throw when invoking setter on the host element', () => {
it('should throw when invoking setter on the host element', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);

expect(() => {
elm.outerHTML = '<span>Hello World!</span>';
}).toThrowError();
}).toThrowError(TypeError);
});

// TODO [#991]: Add error type to the .toThrowError(<type>) matcher once the issue is fixed.
xit('should log an error when invoking setter for an element in the shadow', () => {
it('should log an error when invoking setter for an element in the shadow', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);

expect(() => {
const div = elm.shadowRoot.querySelector('div');
div.outerHTML = '<span>Hello World!</span>';
}).toThrowError();
}).toThrowError(TypeError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ describe('ShadowRoot.innerHTML', () => {
);
});

// TODO [#991]: No error is thrown when invoking
xit('should throw an error when invoking setter on the shadowRoot', () => {
it('should throw an error when invoking setter on the shadowRoot', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);

Expand Down

0 comments on commit 2a411c9

Please sign in to comment.