mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(chrome): translate idPrefix to a starts-with id match
This commit is contained in:
1 parent
1fcb7a9f7d
commit
59975231ce
2 files changed
+5
No files matched your search
@@ -32,6 +32,8 @@ func TranslateStringSelector(selector string) (string, bool, error) {
|
||||
switch kind {
|
||||
case "id", "resource-id":
|
||||
return `[id="` + cssEscape(value) + `"]`, false, nil
|
||||
case "idPrefix":
|
||||
return `[id^="` + cssEscape(value) + `"]`, false, nil
|
||||
case "class":
|
||||
return `[class~="` + cssEscape(value) + `"]`, false, nil
|
||||
case "tag":
|
||||
|
||||
@@ -21,6 +21,9 @@ func TestTranslateStringSelector_KnownKeys(t *testing.T) {
|
||||
{"accessibilityLabel:logout", `[aria-label="logout"]`, false},
|
||||
{"aria-label:Sign in", `[aria-label="Sign in"]`, false},
|
||||
{"descPrefix:account:", `[aria-label^="account:"]`, false},
|
||||
// Must stay the string pkg/spec/src/web-runtime.ts builds for the same
|
||||
// selector; the two translators feed the same page.
|
||||
{"idPrefix:customer_row_", `[id^="customer_row_"]`, false},
|
||||
{"testTag:submit", `:is([data-testid="submit"], [id="submit"])`, false},
|
||||
{"testID:submit", `[data-testid="submit"]`, false},
|
||||
{"placeholder:Email", `[placeholder="Email"]`, false},
|
||||
|
||||
Reference in new issue
Block a user