Skip to content

Commit 46369b4

Browse files
jaj1014github-actions[bot]
authored andcommitted
Apply formatting changes
1 parent d8d39fc commit 46369b4

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

packages/rrweb-snapshot/src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ export function replaceChromeGridTemplateAreas(rule: CSSStyleRule): string {
217217
for (let i = 0; i < rule.style.length; i++) {
218218
const styleName = rule.style[i];
219219
const styleValue = rule.style.getPropertyValue(styleName);
220-
220+
221221
styleDeclarations.push(`${styleName}: ${styleValue}`);
222222
}
223223

224-
return `${rule.selectorText} { ${styleDeclarations.join('; ')}; }`
224+
return `${rule.selectorText} { ${styleDeclarations.join('; ')}; }`;
225225
}
226226

227227
return rule.cssText;

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

+29-26
Original file line numberDiff line numberDiff line change
@@ -272,25 +272,28 @@ describe('utils', () => {
272272

273273
describe('replaceChromeGridTemplateAreas', () => {
274274
it('does not alter corectly parsed grid template rules', () => {
275-
const cssText = '#wrapper { display: grid; width: 100%; height: 100%; grid-template: minmax(2, 1fr); margin: 0px auto; }';
275+
const cssText =
276+
'#wrapper { display: grid; width: 100%; height: 100%; grid-template: minmax(2, 1fr); margin: 0px auto; }';
276277
const mockCssRule = {
277278
cssText,
278279
selectorText: '#wrapper',
279280
style: {
280-
getPropertyValue (prop) {
281+
getPropertyValue(prop) {
281282
return {
282-
'grid-template-areas': ''
283-
}[prop]
284-
}
285-
}
286-
} as Partial<CSSStyleRule> as CSSStyleRule
283+
'grid-template-areas': '',
284+
}[prop];
285+
},
286+
},
287+
} as Partial<CSSStyleRule> as CSSStyleRule;
287288

288289
expect(replaceChromeGridTemplateAreas(mockCssRule)).toEqual(cssText);
289290
});
290291

291292
it('fixes incorrectly parsed grid template rules', () => {
292-
const cssText1 = '#wrapper { grid-template-areas: "header header" "main main" "footer footer"; grid-template-rows: minmax(2, 1fr); grid-template-columns: minmax(2, 1fr); display: grid; margin: 0px auto; }';
293-
const cssText2 = '.some-class { color: purple; grid-template: "TopNav TopNav" 65px "SideNav Content" 52px "SideNav Content" / 255px auto; column-gap: 32px; }';
293+
const cssText1 =
294+
'#wrapper { grid-template-areas: "header header" "main main" "footer footer"; grid-template-rows: minmax(2, 1fr); grid-template-columns: minmax(2, 1fr); display: grid; margin: 0px auto; }';
295+
const cssText2 =
296+
'.some-class { color: purple; grid-template: "TopNav TopNav" 65px "SideNav Content" 52px "SideNav Content" / 255px auto; column-gap: 32px; }';
294297

295298
const mockCssRule1 = {
296299
cssText: cssText1,
@@ -305,22 +308,22 @@ describe('utils', () => {
305308
getPropertyValue: (key: string): string => {
306309
switch (key) {
307310
case 'grid-template-areas':
308-
return '"header header" "main main" "footer footer"'
311+
return '"header header" "main main" "footer footer"';
309312
case 'grid-template-rows':
310313
return 'minmax(2, 1fr)';
311314
case 'grid-template-columns':
312315
return 'minmax(2, 1fr)';
313-
case'display':
316+
case 'display':
314317
return 'grid';
315-
case'margin':
316-
return '0px auto'
318+
case 'margin':
319+
return '0px auto';
317320
default:
318-
return ''
321+
return '';
319322
}
320323
},
321-
} as Record<string | number, any>
322-
} as Partial<CSSStyleRule> as CSSStyleRule
323-
324+
} as Record<string | number, any>,
325+
} as Partial<CSSStyleRule> as CSSStyleRule;
326+
324327
const mockCssRule2 = {
325328
cssText: cssText2,
326329
selectorText: '.some-class',
@@ -333,28 +336,28 @@ describe('utils', () => {
333336
4: 'column-gap',
334337
getPropertyValue: (key: string): string => {
335338
switch (key) {
336-
case'color':
339+
case 'color':
337340
return 'purple';
338341
case 'grid-template-areas':
339-
return '"TopNav TopNav" "SideNav Content" "SideNav Content"'
342+
return '"TopNav TopNav" "SideNav Content" "SideNav Content"';
340343
case 'grid-template-rows':
341344
return '65px 52px auto';
342345
case 'grid-template-columns':
343346
return '255px auto';
344-
case'column-gap':
345-
return '32px'
347+
case 'column-gap':
348+
return '32px';
346349
default:
347-
return ''
350+
return '';
348351
}
349352
},
350-
} as Record<string | number, any>
351-
} as Partial<CSSStyleRule> as CSSStyleRule
353+
} as Record<string | number, any>,
354+
} as Partial<CSSStyleRule> as CSSStyleRule;
352355

353356
expect(replaceChromeGridTemplateAreas(mockCssRule1)).toEqual(
354-
'#wrapper { grid-template-areas: "header header" "main main" "footer footer"; grid-template-rows: minmax(2, 1fr); grid-template-columns: minmax(2, 1fr); display: grid; margin: 0px auto; }'
357+
'#wrapper { grid-template-areas: "header header" "main main" "footer footer"; grid-template-rows: minmax(2, 1fr); grid-template-columns: minmax(2, 1fr); display: grid; margin: 0px auto; }',
355358
);
356359
expect(replaceChromeGridTemplateAreas(mockCssRule2)).toEqual(
357-
'.some-class { color: purple; grid-template-areas: "TopNav TopNav" "SideNav Content" "SideNav Content"; grid-template-rows: 65px 52px auto; grid-template-columns: 255px auto; column-gap: 32px; }'
360+
'.some-class { color: purple; grid-template-areas: "TopNav TopNav" "SideNav Content" "SideNav Content"; grid-template-rows: 65px 52px auto; grid-template-columns: 255px auto; column-gap: 32px; }',
358361
);
359362
});
360363
});

0 commit comments

Comments
 (0)