Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 48x 1026x 1026x 1026x 920x 920x 1026x 48x 81x 81x 81x 984x 984x 598x 386x 81x 48x 25x 25x 25x 42x 42x 25x 48x 35x 48x | import { ComponentFixture } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; function getAllElementTagsRecursively(el: Element) { const returnList: string[] = []; returnList.push(el.tagName); // eslint-disable-next-line @typescript-eslint/prefer-for-of for (let index = 0; index < el.children.length; index++) { const cel = el.children[index]; returnList.push(...getAllElementTagsRecursively(cel)); } return returnList; } export function findAllCustomElements(el: HTMLElement): string[] { const returnList = []; const tagList = getAllElementTagsRecursively(el); for (const element of tagList) { const tagName = element.toLocaleLowerCase(); // https://stackoverflow.com/a/47737765/13001898 if (!tagName.includes('-')) { continue; } returnList.push(tagName); } return returnList; } export function findAllElements(el: HTMLElement): string[] { const returnList = []; const tagList = getAllElementTagsRecursively(el); for (const element of tagList) { const tagName = element.toLocaleLowerCase(); returnList.push(tagName); } // leave out first testing div return returnList.slice(1); } export function findAllDataTestingIDs(fixture: ComponentFixture<unknown>): string[] { return fixture.debugElement.queryAll(By.css('[data-testing-id]')).map(el => el.attributes['data-testing-id']); } export function createDocumentFromHTML(html: string): Document { const parser = new DOMParser(); return parser.parseFromString(html, 'text/html'); } |