Skip to content

Commit c6c0ee3

Browse files
committed
Add test to show desired behavior for imported stylesheets from seperate directory
1 parent d685bc6 commit c6c0ee3

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ exports[`integration tests > [html file]: with-style-sheet-with-import.html 1`]
500500
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
501501
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"ie=edge\\" />
502502
<title>with style sheet with import</title>
503-
<style>@import url(\\"//fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&amp;family=Roboto:wght@100;300;400;500;700&amp;display=swap\\\\\\"\\");body { margin: 0px; background: url(\\"http://localhost:3030/a.jpg\\"); border-image: url(\\"data:image/svg+xml;utf8,&lt;svg xmlns=\\\\\\"http://www.w3.org/2000/svg\\\\\\" x=\\\\\\"0px\\\\\\" y=\\\\\\"0px\\\\\\" viewBox=\\\\\\"0 0 256 256\\\\\\"&gt;&lt;g&gt;&lt;g&gt;&lt;polygon points=\\\\\\"79.093,0 48.907,30.187 146.72,128 48.907,225.813 79.093,256 207.093,128\\\\\\"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;\\") 100% / 1 / 0 stretch; }p { color: red; background: url(\\"http://localhost:3030/css/b.jpg\\"); }body &gt; p { color: yellow; }</style>
503+
<style>@import url(\\"//fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&amp;family=Roboto:wght@100;300;400;500;700&amp;display=swap\\\\\\"\\");body { margin: 0px; background: url(\\"http://localhost:3030/a.jpg\\"); border-image: url(\\"data:image/svg+xml;utf8,&lt;svg xmlns=\\\\\\"http://www.w3.org/2000/svg\\\\\\" x=\\\\\\"0px\\\\\\" y=\\\\\\"0px\\\\\\" viewBox=\\\\\\"0 0 256 256\\\\\\"&gt;&lt;g&gt;&lt;g&gt;&lt;polygon points=\\\\\\"79.093,0 48.907,30.187 146.72,128 48.907,225.813 79.093,256 207.093,128\\\\\\"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;\\") 100% / 1 / 0 stretch; }p { color: red; background: url(\\"http://localhost:3030/css/b.jpg\\"); }body &gt; p { color: yellow; }body { margin: 0px; background: url(\\"http://localhost:3030/c.jpg\\"); border-image: url(\\"data:image/svg+xml;utf8,&lt;svg xmlns=\\\\\\"http://www.w3.org/2000/svg\\\\\\" x=\\\\\\"0px\\\\\\" y=\\\\\\"0px\\\\\\" viewBox=\\\\\\"0 0 256 256\\\\\\"&gt;&lt;g&gt;&lt;g&gt;&lt;polygon points=\\\\\\"79.093,0 48.907,30.187 146.72,128 48.907,225.813 79.093,256 207.093,128\\\\\\"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;\\") 100% / 1 / 0 stretch; }p { color: red; background: url(\\"http://localhost:3030/alt-css/d.jpg\\"); }body &gt; p { color: yellow; }</style>
504504
</head><body>
505505
</body></html>"
506506
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
body {
2+
margin: 0;
3+
background: url('../c.jpg');
4+
border-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 256 256"><g><g><polygon points="79.093,0 48.907,30.187 146.72,128 48.907,225.813 79.093,256 207.093,128"/></g></g></svg>');
5+
}
6+
p {
7+
color: red;
8+
background: url('./d.jpg');
9+
}
10+
body > p {
11+
color: yellow;
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@import '//fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Roboto:wght@100;300;400;500;700&display=swap"';
22
@import './style.css';
3+
@import '../alt-css/alt-style.css';

packages/rrweb-snapshot/test/snapshot.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
*/
44
import { JSDOM } from 'jsdom';
55
import { describe, it, expect } from 'vitest';
6-
import {
7-
serializeNodeWithId,
8-
_isBlockedElement,
9-
} from '../src/snapshot';
6+
import { serializeNodeWithId, _isBlockedElement } from '../src/snapshot';
107
import snapshot from '../src/snapshot';
118
import { serializedNodeWithId, elementNode } from '../src/types';
129
import { Mirror, absoluteToStylesheet } from '../src/utils';

0 commit comments

Comments
 (0)