test: Add browser tests for the media viewing gallery and viewer (#2661)

This commit is contained in:
Dermot Duffy
2026-08-07 16:08:56 -07:00
committed by GitHub
parent 567690831c
commit 673d8fe133
25 changed files with 1563 additions and 144 deletions
@@ -0,0 +1,11 @@
// The card renders a few elements that give their shadow root a registry of its
// own (`ScopedRegistryHost` from `@lit-labs/scoped-registry-mixin`, used by the
// media filter and the select). That is not something a browser can do
// natively: it needs this polyfill, which Home Assistant loads for the whole
// frontend. Without it, rendering one of those elements throws "importNode is
// not a function" as Lit tries to clone a template into a registry that has no
// document behind it.
//
// It replaces `customElements` and `attachShadow`, so it has to be the first
// thing the page runs -- hence its own setup file, ahead of every other.
import '@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min';