From d84975e0426ba93d158e9d53f0a0e4de13cd4705 Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 17 Aug 2026 23:24:10 +0530 Subject: [PATCH] test(chrome): both resolvers agree on tag where a container's name contains its child's --- .../driver/chrome/selector_parity_test.go | 21 +++++++++++++++++++ .../chrome/testdata/selector-parity.html | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/internal/driver/chrome/selector_parity_test.go b/internal/driver/chrome/selector_parity_test.go index 3a32535..de41d11 100644 --- a/internal/driver/chrome/selector_parity_test.go +++ b/internal/driver/chrome/selector_parity_test.go @@ -108,6 +108,27 @@ func TestSelectors_ResolveTheSameElementsAsTheWebRuntime(t *testing.T) { object: objectSelector("data-state", "sent"), want: []string{"status_badge"}, }, + { + // A custom element's tag name holds a real tag name inside it, so a + // substring rule answered tag:li with and tag:a with + // : the container, not the row the author named. + name: "tag against a page of custom elements", + selector: "tag:li", + object: objectSelector("tag", "li"), + want: []string{"todo_1", "todo_2"}, + }, + { + name: "tag naming the custom element itself", + selector: "tag:todo-list", + object: objectSelector("tag", "todo-list"), + want: []string{"todo_list"}, + }, + { + name: "tag naming an anchor", + selector: "tag:a", + object: objectSelector("tag", "a"), + want: []string{"todo_link"}, + }, { // The root element answers a selector like any other: the string // form scans from the root down, and the object form used to start diff --git a/internal/driver/chrome/testdata/selector-parity.html b/internal/driver/chrome/testdata/selector-parity.html index 63fa30a..4ce8880 100644 --- a/internal/driver/chrome/testdata/selector-parity.html +++ b/internal/driver/chrome/testdata/selector-parity.html @@ -16,5 +16,12 @@
3 unsent
Sent here
Sent Sent
+ + +
  • Buy milk
  • +
  • Pay rent
  • +
    + All +