test: Further improve test coverage (#2422)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:12 -07:00
committed by dermotduffy
parent 050c2f7c1a
commit 9384785d37
5 changed files with 522 additions and 53 deletions
+6 -16
View File
@@ -10,8 +10,9 @@ import { ActionHandlerDetail, ActionHandlerOptions } from './ha/types.js';
import { stopEventFromActivatingCardWideActions } from './utils/action.js';
import { Timer } from './utils/timer.js';
interface ActionHandlerInterface extends HTMLElement {
export interface ActionHandlerInterface extends HTMLElement {
holdTime: number;
connectedCallback(): void;
bind(element: Element, options): void;
}
interface ActionHandlerElement extends HTMLElement {
@@ -55,16 +56,8 @@ class ActionHandler extends HTMLElement implements ActionHandlerInterface {
element.actionHandlerOptions = options;
element.addEventListener('contextmenu', (ev: Event) => {
const e = ev || window.event;
if (e.preventDefault) {
e.preventDefault();
}
if (e.stopPropagation) {
e.stopPropagation();
}
e.cancelBubble = true;
e.returnValue = false;
return false;
ev.preventDefault();
ev.stopPropagation();
});
const start = (): void => {
@@ -167,11 +160,7 @@ const actionHandlerBind = (
element: ActionHandlerElement,
options?: AdvancedCameraCardActionHandlerOptions,
): void => {
const actionhandler: ActionHandler = getActionHandler();
if (!actionhandler) {
return;
}
actionhandler.bind(element, options);
getActionHandler().bind(element, options);
};
export const actionHandler = directive(
@@ -181,6 +170,7 @@ export const actionHandler = directive(
return noChange;
}
// istanbul ignore next -- @preserve Required by Lit Directive API but never called (update() is used instead)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
render(_options?: AdvancedCameraCardActionHandlerOptions) {}
},