| 18 | |
| 19 | describe('scopeCSS', function () { |
| 20 | function normalizeCSS(css: string): string { |
| 21 | return css |
| 22 | .replace(/\s+/g, ' ') |
| 23 | .replace(/:\s/g, ':') |
| 24 | .replace(/'/g, '"') |
| 25 | .replace(/ }/g, '}') |
| 26 | .replace(/url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, (...match: string[]) => `url("${match[2]}")`) |
| 27 | .replace(/\[(.+)=([^"\]]+)\]/g, (...match: string[]) => `[${match[1]}="${match[2]}"]`); |
| 28 | } |
| 29 | |
| 30 | function s(cssText: string, scopeId: string, commentOriginalSelector = false) { |
| 31 | const shim = scopeCss(cssText, scopeId, commentOriginalSelector); |