Add nested css recording for safari
This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 4ceb7eaead
commit 793ff43ed1
2 changed files with 107 additions and 44 deletions

View File

@@ -251,7 +251,7 @@ describe('record', function (this: ISuite) {
assertSnapshot(this.events, __filename, 'stylesheet-rules');
});
it('captures nested stylesheet rules', async () => {
const captureNestedStylesheetRulesTest = async () => {
await this.page.evaluate(() => {
const { record } = ((window as unknown) as IWindow).rrweb;
@@ -295,6 +295,21 @@ describe('record', function (this: ISuite) {
expect(addRuleCount).to.equal(2);
expect(removeRuleCount).to.equal(1);
assertSnapshot(this.events, __filename, 'nested-stylesheet-rules');
};
it('captures nested stylesheet rules', captureNestedStylesheetRulesTest);
describe('without CSSGroupingRule support', () => {
// Safari currently doesn't support CSSGroupingRule, let's test without that
// https://caniuse.com/?search=CSSGroupingRule
beforeEach(async () => {
await this.page.evaluate(() => {
/* @ts-ignore: override CSSGroupingRule */
CSSGroupingRule = undefined;
});
// load a fresh rrweb recorder without CSSGroupingRule
await this.page.evaluate(this.code);
});
it('captures nested stylesheet rules', captureNestedStylesheetRulesTest);
});
});