test(chrome): both resolvers agree on tag where a container's name contains its child's

This commit is contained in:
pj committed 2026-08-17 23:24:10 +05:30
1 parent 9012ffa304
commit d84975e042
2 files changed
+28

No files matched your search

@@ -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 <todo-list> and tag:a with
// <todo-app>: 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
+7
View File
@@ -16,5 +16,12 @@
<div id="unsent_row"><span id="unsent_badge">3<!-- --> unsent</span></div>
<div id="split_row">Sen<span id="split_tail">t here</span></div>
<div id="nested_row">Sent <span id="nested_badge">Sent</span></div>
<todo-app id="todo_app">
<todo-list id="todo_list">
<li id="todo_1">Buy milk</li>
<li id="todo_2">Pay rent</li>
</todo-list>
<a id="todo_link" href="#/all">All</a>
</todo-app>
</body>
</html>