From 729d8ee74a77449d7380a81e5acae60ca3c4ed18 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Tue, 9 Apr 2024 10:33:45 +0100 Subject: [PATCH] Add test from example at https://github.com/PostHog/posthog/pull/21427 --- packages/rrweb-snapshot/test/css.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/rrweb-snapshot/test/css.test.ts b/packages/rrweb-snapshot/test/css.test.ts index 2818386071..1b570644b9 100644 --- a/packages/rrweb-snapshot/test/css.test.ts +++ b/packages/rrweb-snapshot/test/css.test.ts @@ -119,6 +119,17 @@ describe('css parser', () => { expect(out3).toEqual('[data-aa\\:other] { color: red; }'); }); + it('parses nested commas in selectors correctly', () => { + const result = parse( + ` +body > ul :is(li:not(:first-of-type) a:hover, li:not(:first-of-type).active a) { + background: red; +} +`, + ); + expect((result.stylesheet!.rules[0] as Rule)!.selectors!.length).toEqual(1); + }); + it('parses imports with quotes correctly', () => { const out1 = escapeImportStatement({ cssText: `@import url("/foo.css;900;800"");`,