Skip to content

Commit c337ea1

Browse files
author
Kent C. Dodds
committed
fix(ByLabel): use getNodeText abstraction instead of textContent
Closes #190
1 parent e182885 commit c337ea1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/get-node-text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function getNodeText(node) {
22
const window = node.ownerDocument.defaultView
33

44
if (node.matches('input[type=submit], input[type=button]')) {
5-
return node.value;
5+
return node.value
66
}
77

88
return Array.from(node.childNodes)

src/queries.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function queryAllLabelsByText(
2121
const matcher = exact ? matches : fuzzyMatches
2222
const matchNormalizer = makeNormalizer({collapseWhitespace, trim, normalizer})
2323
return Array.from(container.querySelectorAll('label')).filter(label =>
24-
matcher(label.textContent, label, text, matchNormalizer),
24+
matcher(getNodeText(label), label, text, matchNormalizer),
2525
)
2626
}
2727

src/wait-for-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function waitForElement(
2222
const observer = newMutationObserver(onMutation)
2323
observer.observe(container, mutationObserverOptions)
2424
function onDone(error, result) {
25-
const setImmediate = getSetImmediate();
25+
const setImmediate = getSetImmediate()
2626
clearTimeout(timer)
2727
setImmediate(() => observer.disconnect())
2828
if (error) {

typings/get-queries-for-element.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export type BoundFunction<T> = T extends (
99
) => infer R
1010
? (text: P, options?: Q) => R
1111
: T extends (a1: any, text: infer P, options: infer Q) => infer R
12-
? (text: P, options?: Q) => R
13-
: never
12+
? (text: P, options?: Q) => R
13+
: never
1414
export type BoundFunctions<T> = {[P in keyof T]: BoundFunction<T[P]>}
1515

1616
export function getQueriesForElement(

0 commit comments

Comments
 (0)