[ci] format
This commit is contained in:
parent
7325df4121
commit
12a10fe7c5
4 changed files with 10 additions and 6 deletions
|
@ -19,8 +19,8 @@ test.describe('CSS Sourcemap HMR', () => {
|
||||||
test.skip(isWindows, 'TODO: fix css hmr in windows');
|
test.skip(isWindows, 'TODO: fix css hmr in windows');
|
||||||
|
|
||||||
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
|
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
|
||||||
const html = await astro.fetch('/').then(res => res.text());
|
const html = await astro.fetch('/').then((res) => res.text());
|
||||||
|
|
||||||
// style[data-astro-dev-id] should exist in initial SSR'd markup
|
// style[data-astro-dev-id] should exist in initial SSR'd markup
|
||||||
expect(html).toMatch('data-astro-dev-id');
|
expect(html).toMatch('data-astro-dev-id');
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ test.describe('CSS HMR', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
|
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
|
||||||
const html = await astro.fetch('/').then(res => res.text());
|
const html = await astro.fetch('/').then((res) => res.text());
|
||||||
|
|
||||||
// style[data-astro-dev-id] should exist in initial SSR'd markup
|
// style[data-astro-dev-id] should exist in initial SSR'd markup
|
||||||
expect(html).toMatch('data-astro-dev-id');
|
expect(html).toMatch('data-astro-dev-id');
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ async function getScriptsAndStyles({ env, filePath }: GetScriptsAndStylesParams)
|
||||||
props: {
|
props: {
|
||||||
type: 'text/css',
|
type: 'text/css',
|
||||||
// Track the ID so we can match it to Vite's injected style later
|
// Track the ID so we can match it to Vite's injected style later
|
||||||
'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root))
|
'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root)),
|
||||||
},
|
},
|
||||||
children: content,
|
children: content,
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,5 +42,9 @@ function isStyle(node: Node): node is HTMLStyleElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isViteInjectedStyle(node: Node): node is HTMLStyleElement {
|
function isViteInjectedStyle(node: Node): node is HTMLStyleElement {
|
||||||
return isStyle(node) && node.getAttribute('type') === 'text/css' && !!node.getAttribute('data-vite-dev-id');
|
return (
|
||||||
|
isStyle(node) &&
|
||||||
|
node.getAttribute('type') === 'text/css' &&
|
||||||
|
!!node.getAttribute('data-vite-dev-id')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue