/
placeholder-text.js
35 lines (31 loc) 路 1.08 KB
/
placeholder-text.js
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
import {wrapAllByQueryWithSuggestion} from '../query-helpers'
import {checkContainerType} from '../helpers'
import {queryAllByAttribute, buildQueries} from './all-utils'
function queryAllByPlaceholderText(...args) {
checkContainerType(...args)
return queryAllByAttribute('placeholder', ...args)
}
const getMultipleError = (c, text) =>
`Found multiple elements with the placeholder text of: ${text}`
const getMissingError = (c, text) =>
`Unable to find an element with the placeholder text of: ${text}`
const queryAllByPlaceholderTextWithSuggestions = wrapAllByQueryWithSuggestion(
queryAllByPlaceholderText,
queryAllByPlaceholderText.name,
'queryAll',
)
const [
queryByPlaceholderText,
getAllByPlaceholderText,
getByPlaceholderText,
findAllByPlaceholderText,
findByPlaceholderText,
] = buildQueries(queryAllByPlaceholderText, getMultipleError, getMissingError)
export {
queryByPlaceholderText,
queryAllByPlaceholderTextWithSuggestions as queryAllByPlaceholderText,
getByPlaceholderText,
getAllByPlaceholderText,
findAllByPlaceholderText,
findByPlaceholderText,
}