We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eba7e82 commit 600f9b5Copy full SHA for 600f9b5
src/queries/role.js
@@ -107,8 +107,18 @@ function queryAllByRole(
107
})
108
}
109
110
-const getMultipleError = (c, role, {name} = {}) =>
111
- `Found multiple elements with the role "${role}" matching ${name}`
+const getMultipleError = (c, role, {name} = {}) => {
+ let nameHint = ''
112
+ if (name === undefined) {
113
+ nameHint = ''
114
+ } else if (typeof name === 'string') {
115
+ nameHint = ` and name "${name}"`
116
+ } else {
117
+ nameHint = ` and name \`${name}\``
118
+ }
119
+
120
+ return `Found multiple elements with the role "${role}"${nameHint}`
121
+}
122
123
const getMissingError = (
124
container,
0 commit comments