UNPKG

@sparser/au2-data-grid

Version:
33 lines 1.17 kB
/** * @returns {HTMLElement[]} All grid-header elements when the default template is used. */ export function getHeaders(grid) { return Array.from(grid.querySelectorAll('.row:first-of-type grid-header')); } /** * @returns {string[]} textContents from all the grid-header elements when the default template is used. */ export function getHeaderTextContent(grid) { return getHeaders(grid) .map(header => getText(header.querySelector('div>span'))); } /** * @returns {HTMLElement[]} All grid-header elements when the default template is used. */ export function getContentRows(grid) { return Array.from(grid.querySelectorAll('.row:not(:first-of-type)')); } /** * @returns {(string | null)[][]} All content-row text when the default template is used. */ export function getContentTextContent(grid) { return Array.from(grid.querySelectorAll('.row:not(:first-of-type)')) .map(row => Array.from(row.children).map(el => getText(el))); } /** * @returns {string | null} returns the trimmed text content of the given `el`. */ export function getText(el) { return el?.textContent?.trim() ?? null; } //# sourceMappingURL=test-helpers.js.map