Skip to content

Commit fbe7afb

Browse files
committed
test(theme): add scoped element test
1 parent 88ff275 commit fbe7afb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/utils/test/theme.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { newSpecPage } from '@stencil/core/testing';
22

3+
import { Buttons } from '../../components/buttons/buttons';
34
import { CardContent } from '../../components/card-content/card-content';
45
import { Chip } from '../../components/chip/chip';
56
import {
@@ -284,6 +285,20 @@ describe('injectCSS', () => {
284285

285286
expect(shadowRoot!.innerHTML).toContain(`<style>${css}</style>`);
286287
});
288+
289+
it('should inject CSS into a scoped element', async () => {
290+
const page = await newSpecPage({
291+
components: [Buttons],
292+
html: '<ion-buttons></ion-buttons>',
293+
});
294+
295+
const target = page.body.querySelector('ion-buttons')!;
296+
297+
const css = ':host { background-color: red; }';
298+
injectCSS(css, target);
299+
300+
expect(target.innerHTML).toContain(`<style>${css}</style>`);
301+
});
287302
});
288303

289304
describe('generateGlobalThemeCSS', () => {

0 commit comments

Comments
 (0)