From 2a411c9c0e14643a90d754ddf9c3b049ff22106b Mon Sep 17 00:00:00 2001 From: Ravi Jayaramappa Date: Mon, 13 Jan 2020 16:38:31 -0800 Subject: [PATCH] test: test setting innerHTML, outerHTML on host will throw fixed in https://github.com/salesforce/lwc/pull/1001 --- .../Element-properties/Element.innerHTML.spec.js | 5 ++--- .../Element-properties/Element.outerHTML.spec.js | 10 ++++------ .../ShadowRoot-properties/ShadowRoot.innerHTML.spec.js | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/integration-karma/test/shadow-dom/Element-properties/Element.innerHTML.spec.js b/packages/integration-karma/test/shadow-dom/Element-properties/Element.innerHTML.spec.js index bb21c2c3a2..fafbb773b0 100644 --- a/packages/integration-karma/test/shadow-dom/Element-properties/Element.innerHTML.spec.js +++ b/packages/integration-karma/test/shadow-dom/Element-properties/Element.innerHTML.spec.js @@ -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 = 'Hello World!'; - }).toThrowError(); + }).toThrowError(TypeError); }); it('should log an error when invoking setter for an element in the shadow', () => { diff --git a/packages/integration-karma/test/shadow-dom/Element-properties/Element.outerHTML.spec.js b/packages/integration-karma/test/shadow-dom/Element-properties/Element.outerHTML.spec.js index 1b64a4439e..6df4705479 100644 --- a/packages/integration-karma/test/shadow-dom/Element-properties/Element.outerHTML.spec.js +++ b/packages/integration-karma/test/shadow-dom/Element-properties/Element.outerHTML.spec.js @@ -29,24 +29,22 @@ describe('Element.outerHTML - get', () => { }); describe('Element.outerHTML - set', () => { - // TODO [#991]: Add error type to the .toThrowError() 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 = 'Hello World!'; - }).toThrowError(); + }).toThrowError(TypeError); }); - // TODO [#991]: Add error type to the .toThrowError() 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 = 'Hello World!'; - }).toThrowError(); + }).toThrowError(TypeError); }); }); diff --git a/packages/integration-karma/test/shadow-dom/ShadowRoot-properties/ShadowRoot.innerHTML.spec.js b/packages/integration-karma/test/shadow-dom/ShadowRoot-properties/ShadowRoot.innerHTML.spec.js index 6ac220ccc9..f267aea8e7 100644 --- a/packages/integration-karma/test/shadow-dom/ShadowRoot-properties/ShadowRoot.innerHTML.spec.js +++ b/packages/integration-karma/test/shadow-dom/ShadowRoot-properties/ShadowRoot.innerHTML.spec.js @@ -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);