From 8f6498dd1e5dd60073fe24eb2bff7c780e2a2517 Mon Sep 17 00:00:00 2001 From: Jeff Nguyen Date: Mon, 15 Jul 2024 22:17:06 -0400 Subject: [PATCH] Add test to show desired behavior for imported stylesheets from seperate directory --- .../test/__snapshots__/integration.test.ts.snap | 2 +- packages/rrweb-snapshot/test/alt-css/alt-style.css | 12 ++++++++++++ .../rrweb-snapshot/test/css/style-with-import.css | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/rrweb-snapshot/test/alt-css/alt-style.css diff --git a/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap b/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap index ee9d95245d..7f3a4ac431 100644 --- a/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap +++ b/packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap @@ -500,7 +500,7 @@ exports[`integration tests > [html file]: with-style-sheet-with-import.html 1`] with style sheet with import - + " `; diff --git a/packages/rrweb-snapshot/test/alt-css/alt-style.css b/packages/rrweb-snapshot/test/alt-css/alt-style.css new file mode 100644 index 0000000000..0f935c87f2 --- /dev/null +++ b/packages/rrweb-snapshot/test/alt-css/alt-style.css @@ -0,0 +1,12 @@ +body { + margin: 0; + background: url('../c.jpg'); + border-image: url('data:image/svg+xml;utf8,'); + } + p { + color: red; + background: url('./d.jpg'); + } + body > p { + color: yellow; + } diff --git a/packages/rrweb-snapshot/test/css/style-with-import.css b/packages/rrweb-snapshot/test/css/style-with-import.css index 5fa59d8039..a24d901947 100644 --- a/packages/rrweb-snapshot/test/css/style-with-import.css +++ b/packages/rrweb-snapshot/test/css/style-with-import.css @@ -1,2 +1,3 @@ @import '//fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Roboto:wght@100;300;400;500;700&display=swap"'; @import './style.css'; +@import '../alt-css/alt-style.css';