The z-index of the last rule whose selector list names `selector` exactly, across the given sheets.
(selector: string, ...files: string[])
| 37 | |
| 38 | /** The z-index of the last rule whose selector list names `selector` exactly, across the given sheets. */ |
| 39 | function zIndex(selector: string, ...files: string[]): number { |
| 40 | let found: number | undefined; |
| 41 | for (const file of files) { |
| 42 | const css = readFileSync(new URL(file, import.meta.url), 'utf8').replace(/\/\*[\s\S]*?\*\//g, ''); |
| 43 | for (const match of css.matchAll(/([^{}]+)\{([^}]*)\}/g)) { |
| 44 | if (!match[1]!.split(',').map(item => item.trim()).includes(selector)) continue; |
| 45 | const value = /z-index:\s*(\d+)/.exec(match[2]!)?.[1]; |
| 46 | if (value !== undefined) found = Number(value); |
| 47 | } |
| 48 | } |
| 49 | expect(found, selector).toBeDefined(); |
| 50 | return found!; |
| 51 | } |
| 52 | const SHEETS = ['./graph-exploration.css', '../styles/terminal.css', '../why/selection-context.css']; |
| 53 | |
| 54 | describe('K29: the hover card stands above the Galaxy panels', () => { |
no test coverage detected