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:
@@ -6,6 +6,7 @@ import {
|
||||
type DirectiveParameters,
|
||||
} from 'lit/directive.js';
|
||||
|
||||
import { ACTION_HANDLER_HOLD_SECONDS } from './const.js';
|
||||
import { fireHASSEvent } from './ha/fire-hass-event.js';
|
||||
import type { ActionHandlerDetail, ActionHandlerOptions } from './ha/types.js';
|
||||
import { stopEventFromActivatingCardWideActions } from './utils/action.js';
|
||||
@@ -24,9 +25,6 @@ interface AdvancedCameraCardActionHandlerOptions extends ActionHandlerOptions {
|
||||
allowPropagation?: boolean;
|
||||
}
|
||||
|
||||
// How long a press must last to count as a hold rather than a tap.
|
||||
export const ACTION_HANDLER_HOLD_SECONDS = 0.4;
|
||||
|
||||
class ActionHandler extends HTMLElement implements ActionHandlerInterface {
|
||||
public holdTime = ACTION_HANDLER_HOLD_SECONDS;
|
||||
|
||||
|
||||
@@ -15,6 +15,13 @@ export const TROUBLESHOOTING_LEGACY_RESOURCE_URL =
|
||||
export const TROUBLESHOOTING_MEDIA_URL =
|
||||
`${TROUBLESHOOTING_URL}?id=media-unavailable` as const;
|
||||
|
||||
// ===========================================================================
|
||||
// Interaction Constants
|
||||
// ===========================================================================
|
||||
|
||||
// How long a press must last to count as a hold rather than a tap.
|
||||
export const ACTION_HANDLER_HOLD_SECONDS = 0.4;
|
||||
|
||||
// ===========================================================================
|
||||
// Media Constants
|
||||
// ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user