Skip to content

Commit b55a327

Browse files
committed
fix: fix shadowRoot typing in TS
1 parent e1478c7 commit b55a327

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app-min/test/my-app.spec.ext

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ test('my-app: should render message', async t => {
3737
// In Shadow DOM open mode, shadowRoot is also accessible through DOM API
3838
// node.shadowRoot
3939
// But only Aurelia API can access shadowRoot in both open and closed mode.
40-
const text = CustomElement.for(node).projector.shadowRoot.textContent;
40+
const shadowRoot = CustomElement.for(node).projector.provideEncapsulationSource();
41+
// @if babel
42+
const text = shadowRoot.textContent;
43+
// @endif
44+
// @if typescript
45+
const text = (shadowRoot as Node).textContent;
46+
// @endif
4147
// @endif
4248
// @if !shadow-dom
4349
const text = node.textContent;
@@ -69,7 +75,13 @@ describe('my-app', () => {
6975
// In Shadow DOM open mode, shadowRoot is also accessible through DOM API
7076
// node.shadowRoot
7177
// But only Aurelia API can access shadowRoot in both open and closed mode.
72-
const text = CustomElement.for(node).projector.shadowRoot.textContent;
78+
const shadowRoot = CustomElement.for(node).projector.provideEncapsulationSource();
79+
// @if babel
80+
const text = shadowRoot.textContent;
81+
// @endif
82+
// @if typescript
83+
const text = (shadowRoot as Node).textContent;
84+
// @endif
7385
// @endif
7486
// @if !shadow-dom
7587
const text = node.textContent;

0 commit comments

Comments
 (0)