mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-02 22:37:58 +00:00
20 lines
479 B
TypeScript
20 lines
479 B
TypeScript
![]() |
import { TestContext } from 'ember-test-helpers';
|
||
|
|
||
|
export const getText = (test: TestContext) => {
|
||
|
return (test.element.textContent || '').trim();
|
||
|
};
|
||
|
|
||
|
export const getTextNoSpaces = (test: TestContext) => {
|
||
|
return getText(test).replace(/\s/gi, '');
|
||
|
};
|
||
|
|
||
|
export const querySelector = <E extends Element>(test: TestContext, selector: string): E | null => {
|
||
|
const element = test.element;
|
||
|
|
||
|
if (!element) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
return element.querySelector<E>(selector);
|
||
|
};
|