Add support for StylesheetRule in document fragment (#293)
* add failing test * add stylesheet to dom to manipulate the rules * cleanup
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
sampleEvents as events,
|
||||
sampleStyleSheetRemoveEvents as stylesheetRemoveEvents
|
||||
} from './utils';
|
||||
import styleSheetRuleEvents from './events/style-sheet-rule-events';
|
||||
|
||||
interface ISuite extends Suite {
|
||||
code: string;
|
||||
@@ -135,6 +136,19 @@ describe('replayer', function (this: ISuite) {
|
||||
expect(currentState).to.equal('paused');
|
||||
});
|
||||
|
||||
it('can fast forward past StyleSheetRule changes on virtual elements', async () => {
|
||||
await this.page.evaluate(`events = ${JSON.stringify(styleSheetRuleEvents)}`);
|
||||
const actionLength = await this.page.evaluate(`
|
||||
const { Replayer } = rrweb;
|
||||
const replayer = new Replayer(events);
|
||||
replayer.play(1500);
|
||||
replayer['timer']['actions'].length;
|
||||
`);
|
||||
expect(actionLength).to.equal(
|
||||
styleSheetRuleEvents.filter((e) => e.timestamp - styleSheetRuleEvents[0].timestamp >= 1500).length,
|
||||
);
|
||||
});
|
||||
|
||||
it('can handle removing style elements', async () => {
|
||||
await this.page.evaluate(`events = ${JSON.stringify(stylesheetRemoveEvents)}`);
|
||||
const actionLength = await this.page.evaluate(`
|
||||
|
||||
Reference in New Issue
Block a user