(page)
| 877 | * wie `explainsMore` in src/ui/tooltip/tooltip-model.ts. |
| 878 | */ |
| 879 | export async function nativeTitles(page) { |
| 880 | return page.evaluate(() => { |
| 881 | const tidy = (value) => value.replace(/\s+/g, ' ').trim().toLowerCase(); |
| 882 | const out = []; |
| 883 | for (const node of document.querySelectorAll('[title]')) { |
| 884 | if (node.closest('.monaco-editor') !== null) { |
| 885 | continue; |
| 886 | } |
| 887 | const said = tidy(node.getAttribute('title') ?? ''); |
| 888 | if (said.length === 0) { |
| 889 | continue; |
| 890 | } |
| 891 | const shown = tidy(node.textContent ?? ''); |
| 892 | if (shown.includes(said)) { |
| 893 | continue; |
| 894 | } |
| 895 | out.push({ |
| 896 | path: node.tagName.toLowerCase() |
| 897 | + (node.getAttribute('data-testid') === null |
| 898 | ? '' |
| 899 | : `[${node.getAttribute('data-testid')}]`), |
| 900 | title: said.slice(0, 90), |
| 901 | text: shown.slice(0, 60), |
| 902 | }); |
| 903 | } |
| 904 | return out; |
| 905 | }); |
| 906 | } |
no test coverage detected