test: Add a test harness for the built card (#2653)
Mounts the card from `dist/` the way Home Assistant does, by URL with a HACS tag, and asserts the entry stays a facade, that no chunk imports it, that the browser is served the file unmodified, and that the card starts up and fetches a language chunk lazily. Runs in Chromium, Firefox and WebKit, so a change of bundler or minifier is checked against every engine.
This commit is contained in:
@@ -2,7 +2,11 @@ import { assert, describe, expect, it } from 'vitest';
|
||||
|
||||
import type { LogActionConfig } from '../../src/config/schema/actions/custom/log';
|
||||
import { createLogAction } from '../../src/utils/action';
|
||||
import { MountedCard, type MountOptions } from '../browser/mounted-card';
|
||||
import {
|
||||
MountedCardFactory,
|
||||
type MountedCard,
|
||||
type MountOptions,
|
||||
} from '../browser/mounted-card';
|
||||
import {
|
||||
CARD_INITIALIZED_MESSAGE,
|
||||
clickElement,
|
||||
@@ -44,7 +48,7 @@ interface MountCardOptions extends MountOptions {
|
||||
const mountCard = async (options?: MountCardOptions): Promise<MountedCard> => {
|
||||
const { keyMessage, ...mountOptions } = options ?? {};
|
||||
|
||||
const card = await MountedCard.create(
|
||||
const card = await MountedCardFactory.createFromSource(
|
||||
createStillImageCardConfig({
|
||||
menu: { style: 'outside', buttons: { expand: { enabled: true } } },
|
||||
elements: [
|
||||
|
||||
Reference in New Issue
Block a user