mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
14 lines
430 B
JavaScript
14 lines
430 B
JavaScript
|
import {findAll} from '@ember/test-helpers';
|
||
|
|
||
|
export function elementHasText(element, text) {
|
||
|
return RegExp(text).test(element.textContent);
|
||
|
}
|
||
|
|
||
|
export function findWithText(selector, text) {
|
||
|
return Array.from(findAll(selector)).find(element => elementHasText(element, text));
|
||
|
}
|
||
|
|
||
|
export function findAllWithText(selector, text) {
|
||
|
return Array.from(findAll(selector)).filter(element => elementHasText(element, text));
|
||
|
}
|