Files
houseplan-card/test/native-select-contract.test.mjs
T
Matysh 01980ac3e6
Validate / hacs (push) Failing after 10s
Validate / hassfest (push) Failing after 11s
Validate / frontend (push) Successful in 4m20s
Validate / backend (push) Failing after 4m47s
Validate / golden (push) Failing after 6m33s
Validate / performance_smoke (push) Failing after 9m34s
Validate / smoke (push) Failing after 19m8s
Release v1.62.0-beta.7 candidate
2026-08-12 15:13:38 +03:00

17 lines
775 B
JavaScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
const source = readFileSync(new URL('../src/houseplan-card.ts', import.meta.url), 'utf8');
test('native selects never rely on value assignment before dynamic options mount', () => {
const blocks = [...source.matchAll(/<select\b[\s\S]*?<\/select>/g)].map((match) => match[0]);
const valueBoundIds = blocks
.filter((block) => /\.value\s*=\s*\$\{/.test(block))
.map((block) => block.match(/\bid="([^"]+)"/)?.[1] || '(missing id)');
// This is a command menu, not persisted state: it intentionally resets to
// its empty first row after inserting an HA variable into decorative text.
assert.deepEqual(valueBoundIds, ['decor-live-attribute']);
});