Skip to content

Commit 005687e

Browse files
authored
Tests: avoid inline scripts (darkreader#11388)
1 parent 27afb1b commit 005687e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/inject/dynamic/media-query.tests.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('MEDIA QUERIES', () => {
4242

4343
it('should style lazyloaded media', async () => {
4444
container.innerHTML = multiline(
45-
'<style class="testcase-style" media="print" onload="this.media=`screen`">',
45+
'<style class="testcase-style" media="print">',
4646
' h1 { background: green; }',
4747
' h1 strong { color: orange; }',
4848
'</style>',
@@ -51,7 +51,9 @@ describe('MEDIA QUERIES', () => {
5151

5252
createOrUpdateDynamicTheme(theme, null, false);
5353

54+
(document.querySelector('.testcase-style') as HTMLStyleElement).media = 'screen';
5455
await timeout(0);
56+
expect((document.querySelector('.testcase-style') as HTMLStyleElement).media).toBe('screen');
5557
expect(getComputedStyle(document.querySelector('h1')).backgroundColor).toBe('rgb(0, 102, 0)');
5658
expect(getComputedStyle(document.querySelector('h1 strong')).color).toBe('rgb(255, 174, 26)');
5759
expect(document.querySelector('.testcase-style').nextElementSibling.classList.contains('darkreader--sync')).toBe(true);

0 commit comments

Comments
 (0)