mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
fix(web): resolve testTag through data-testid or id
Compose Multiplatform emits its testTag into the element id, which the native table already accepts via the resource-id alias. The two web selector tables were the only place that rejected it. Claude-Session: https://claude.ai/code/session_01Fj4wJUikdABuMQEETwW55J
This commit is contained in:
1 parent
be2fbadc9d
commit
d25b56379a
4 files changed
+31
-3
No files matched your search
@@ -42,7 +42,13 @@ func TranslateStringSelector(selector string) (string, bool, error) {
|
||||
return `[aria-label="` + cssEscape(value) + `"]`, false, nil
|
||||
case "descPrefix":
|
||||
return `[aria-label^="` + cssEscape(value) + `"]`, false, nil
|
||||
case "testTag", "testID", "testid", "data-testid":
|
||||
case "testTag":
|
||||
// Mirrors the in-page table and the native resource-id alias: a
|
||||
// testTag reaches the DOM as data-testid or as an id, depending on
|
||||
// the toolkit. `:is()` keeps this one compound selector.
|
||||
escaped := cssEscape(value)
|
||||
return `:is([data-testid="` + escaped + `"], [id="` + escaped + `"])`, false, nil
|
||||
case "testID", "testid", "data-testid":
|
||||
return `[data-testid="` + cssEscape(value) + `"]`, false, nil
|
||||
case "placeholder", "placeholderValue", "hintText":
|
||||
return `[placeholder="` + cssEscape(value) + `"]`, false, nil
|
||||
|
||||
@@ -21,7 +21,7 @@ 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},
|
||||
{"testTag:submit", `[data-testid="submit"]`, 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