From 53ee9aa292cd94fbf14d3f93b2f44216321ea3f5 Mon Sep 17 00:00:00 2001 From: PJ Date: Wed, 19 Aug 2026 09:55:25 +0530 Subject: [PATCH] test(chrome): compare className across both matchers one page, both resolvers, the two names for the one attribute. class is asked beside className so the pair is pinned to the same elements rather than each to itself: the row and the badge under it both carry it. --- .../driver/chrome/selector_parity_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/driver/chrome/selector_parity_test.go b/internal/driver/chrome/selector_parity_test.go index 7166f4f..c91d0da 100644 --- a/internal/driver/chrome/selector_parity_test.go +++ b/internal/driver/chrome/selector_parity_test.go @@ -108,6 +108,25 @@ func TestSelectors_ResolveTheSameElementsAsTheWebRuntime(t *testing.T) { object: objectSelector("data-state", "sent"), want: []string{"status_badge"}, }, + { + name: "class", + selector: "class:status", + object: objectSelector("class", "status"), + want: []string{"nested_row", "nested_badge"}, + }, + { + // className is the DOM property name for the same attribute, and + // the two names have to name the same elements: the web runtime + // compiles both to the same class query, while the dump carries + // the fact under `class` alone and no alias reached it, so this + // key matched the row and the badge on one host and NOTHING on the + // other. The key is accepted, so no unknown-key error fires, and a + // property over the missing element passes having checked nothing. + name: "className", + selector: "className:status", + object: objectSelector("className", "status"), + want: []string{"nested_row", "nested_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