fix: Restore picture element actions on Home Assistant 2026.8+ (#2670)

- Closes: #2663
This commit is contained in:
Dermot Duffy
2026-08-09 20:58:15 -07:00
committed by GitHub
parent a8ce6acb44
commit 45f88a86a4
5 changed files with 380 additions and 10 deletions
+32
View File
@@ -0,0 +1,32 @@
import { describe, expect, it } from 'vitest';
import { MountedCardFactory } from '../browser/mounted-card';
import {
createGenericCameraHASS,
createStillImageCardConfig,
} from '../browser/test-utils';
interface PictureElement extends Element {
delegatedActions: boolean;
}
describe('AdvancedCameraCardElements', () => {
it('should have a picture element listen for its own taps', async () => {
// See: https://github.com/dermotduffy/advanced-camera-card/issues/2664
const card = await MountedCardFactory.createFromSource(
createStillImageCardConfig({
elements: [
{ type: 'icon', icon: 'mdi:cow', tap_action: { action: 'more-info' } },
],
}),
createGenericCameraHASS(),
);
const element = await card.waitForSelector<PictureElement>('hui-icon-element');
// Home Assistant has this element wait for the container rendering it to
// dispatch the action for it. This card cannot do that as we require
// "behind" the elements to be able to receive pointer interactions.
expect(element.delegatedActions).toBe(false);
});
});