-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-2351 Run all browser tests with and without polyfill
remove unnecessary polyfill loading scripts that need polyfill import themselves + unnecessary mocking removal separate tests that require polyfill from tests that do not remove unneeded test web test runner create groups for tests to run with and without polyfills refactor: rename
- Loading branch information
1 parent
4696ad7
commit 2e883d6
Showing
3 changed files
with
86 additions
and
116 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/ui/components/core/test/SlotMixin.polyfill.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sinon from 'sinon'; | ||
import { defineCE, expect, fixture, unsafeStatic, html } from '@open-wc/testing'; | ||
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js'; | ||
import { SlotMixin } from '@lion/ui/core.js'; | ||
import { LitElement } from 'lit'; | ||
|
||
it('supports scoped elements when polyfill loaded', async () => { | ||
// @ts-ignore the scoped-custom-element-registry polyfill makes sure `ShadowRoot.prototype.createElement` is defined | ||
const createElementSpy = sinon.spy(ShadowRoot.prototype, 'createElement'); | ||
|
||
class ScopedEl extends LitElement {} | ||
|
||
const tagName = defineCE( | ||
class extends ScopedElementsMixin(SlotMixin(LitElement)) { | ||
static get scopedElements() { | ||
return { | ||
// @ts-expect-error | ||
...super.scopedElements, | ||
'scoped-elm': ScopedEl, | ||
}; | ||
} | ||
|
||
get slots() { | ||
return { | ||
...super.slots, | ||
template: () => html`<scoped-elm></scoped-elm>`, | ||
}; | ||
} | ||
|
||
render() { | ||
return html`<slot name="template"></slot>`; | ||
} | ||
}, | ||
); | ||
|
||
const tag = unsafeStatic(tagName); | ||
await fixture(html`<${tag}></${tag}>`); | ||
|
||
expect(createElementSpy.getCalls()).to.have.length(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters