Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samarsault committed Feb 9, 2023
1 parent ff1bdff commit 36a13bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/dom/test/serialize-css.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ describe('serializeCSSOM', () => {
'<p>Percy-0</p>',
'</template>'
].join(''));

shadowEl.shadowRoot.adoptedStyleSheets = [];
});

it('uses single resource for same adoptedStylesheet', () => {
Expand Down Expand Up @@ -133,6 +135,9 @@ describe('serializeCSSOM', () => {
'<p>Percy-1</p>',
'</template>'
].join(''));

shadowEl.shadowRoot.adoptedStyleSheets = [];
shadowElChild.shadowRoot.adoptedStyleSheets = [];
});
});
});
11 changes: 7 additions & 4 deletions packages/dom/test/serialize-dom.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withExample, replaceDoctype, createShadowEl, getTestBrowser, chromeBrowser, firefoxBrowser } from './helpers';
import { withExample, replaceDoctype, createShadowEl, getTestBrowser, chromeBrowser } from './helpers';
import serializeDOM from '@percy/dom';

describe('serializeDOM', () => {
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('serializeDOM', () => {
});

it('renders many flat', () => {
if (getTestBrowser() === firefoxBrowser) {
if (!navigator.userAgent.toLowerCase().includes('chrome')) {
return;
}
withExample('<div id="content"></div>', { withShadow: false });
Expand All @@ -153,6 +153,9 @@ describe('serializeDOM', () => {
});

it('respects disableShadowDOM', () => {
if (!navigator.userAgent.toLowerCase().includes('chrome')) {
return;
}
withExample('<div id="content"></div>', { withShadow: false });
const baseContent = document.querySelector('#content');
const el = createShadowEl(8);
Expand All @@ -168,8 +171,8 @@ describe('serializeDOM', () => {
return;
}
class TestElement extends window.HTMLElement {
constructor() {
super();
connectedCallback() {
// super();
// Create a shadow root
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
const wrapper = document.createElement('h2');
Expand Down

0 comments on commit 36a13bf

Please sign in to comment.