From 7d152e04f94e39595752ce72efcdcf5fa03d3602 Mon Sep 17 00:00:00 2001 From: Matysh Date: Mon, 10 Aug 2026 00:35:23 +0300 Subject: [PATCH] test: align smoke contracts with independent Glow --- demo/smoke_general_settings.mjs | 2 +- demo/smoke_glow.mjs | 10 ++++------ demo/smoke_room_settings.mjs | 9 +++------ demo/smoke_ux_fixes.mjs | 5 ++++- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/demo/smoke_general_settings.mjs b/demo/smoke_general_settings.mjs index 1eaec8dd..ad8ffc5a 100644 --- a/demo/smoke_general_settings.mjs +++ b/demo/smoke_general_settings.mjs @@ -47,7 +47,7 @@ check('bundleVersionFound', typeof BUNDLE_VERSION === 'string' && BUNDLE_VERSION checkAll(res, { "rows": 15, // 11 цветов (включая wall_fill) + радиус свечения + фон // + «Оптимизировать планы» (docs/CANVAS.md §9) - "groups": ["Fill: lights", "Fill: temperature", "Fill: zigbee signal", "Light-sources fill", "Walls", "Stage background", "Sun", "Plan maintenance", "About"], + "groups": ["Fill: lights", "Fill: temperature", "Fill: zigbee signal", "Light-source glow", "Walls", "Stage background", "Sun", "Plan maintenance", "About"], "aboutVersion": `Houseplan Card v${BUNDLE_VERSION}`, // та же константа, что в баннере "aboutLinks": [ { "href": "https://github.com/Matysh/houseplan-card", "target": "_blank", "rel": "noopener" }, diff --git a/demo/smoke_glow.mjs b/demo/smoke_glow.mjs index 9c702840..5b2c290b 100644 --- a/demo/smoke_glow.mjs +++ b/demo/smoke_glow.mjs @@ -10,12 +10,10 @@ const res = await page.evaluate(async () => { ...s, settings: { ...(s.settings || {}), fill_mode: 'glow' } })) }; c.requestUpdate(); await c.updateComplete; await new Promise((r) => setTimeout(r, 250)); - // 1) все комнаты залиты темнотой одинаково (независимо от ламп) - const rooms = [...sr().querySelectorAll('.room.styled')]; - out.roomsDark = rooms.length > 0 && rooms.every((el) => { - const st = el.getAttribute('style') || ''; - return st.includes('--room-fill:#0d1b2a'); - }); + // 1) legacy glow переносится в отдельный base-overlay, не в data-fill комнат + const modelRooms = c._spaceModel().rooms.length; + out.dataFillSeparated = sr().querySelectorAll('.room.filled').length === 0; + out.glowBaseRooms = sr().querySelectorAll('.glow-base-layer .glow-base').length === modelRooms; // 2) пятна от включённых ламп const litLight = c._devices.find((d) => d.space === spId && d.entities.some((e) => e.startsWith('light.') && c.hass.states[e]?.state === 'on')); out.hasLitLight = !!litLight; diff --git a/demo/smoke_room_settings.mjs b/demo/smoke_room_settings.mjs index ad3c92a6..453f5904 100644 --- a/demo/smoke_room_settings.mjs +++ b/demo/smoke_room_settings.mjs @@ -46,16 +46,13 @@ const res = await page.evaluate(async () => { out.createHasSection = [...sr().querySelectorAll('hp-dialog label')].some((l) => l.textContent === c._t('room.settings_section')); out.createHasInherit = [...sr().querySelectorAll('hp-dialog .srcrow')].some((l) => l.textContent.trim() === c._t('fill.inherit')); c._roomDialogCancel(); await c.updateComplete; - // 6) glow-пространство: оверрайд none выводит комнату из тьмы + // 6) room fill:none не выключает независимый Glow пространства c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== spId ? s : ({ ...s, settings: { ...(s.settings || {}), fill_mode: 'glow' } })) }; c._setMode('view'); c.requestUpdate(); await c.updateComplete; await new Promise((r) => setTimeout(r, 250)); - const styledRooms = [...sr().querySelectorAll('.room.styled')]; - const darkCount = styledRooms.filter((el) => (el.getAttribute('style') || '').includes('--room-fill:#0d1b2a')).length; - const areaRooms = c._spaceModel().rooms.filter((r) => r.area).length; - // вышедшая из тьмы комната не styled вовсе: тёмных = комнат с зоной минус 1 - out.glowOptOut = darkCount === areaRooms - 1 && darkCount === styledRooms.length; + out.fillDoesNotOptOutGlow = !sr().querySelector('clipPath#hp-glow-enabled') + && sr().querySelectorAll('.glow-base-layer .glow-base').length === c._spaceModel().rooms.length; return out; }); checkAll(res); diff --git a/demo/smoke_ux_fixes.mjs b/demo/smoke_ux_fixes.mjs index 1f48e272..b716baa9 100644 --- a/demo/smoke_ux_fixes.mjs +++ b/demo/smoke_ux_fixes.mjs @@ -29,6 +29,9 @@ const res = await page.evaluate(async () => { // диалог: радио заливки, компактные поля, ширина c._openSpaceDialog('edit', 'f1'); await c.updateComplete; out.fillRadios = sr().querySelectorAll('input[name="fillmode"]').length; + out.glowToggle = [...sr().querySelectorAll('hp-dialog label.srcrow')].some((label) => + label.textContent.trim() === c._t('space.glow_enabled') + && !!label.querySelector('ha-switch,input[type="checkbox"]')); out.tempInputs = sr().querySelectorAll('.temprange .tempin').length; const hpDialog = sr().querySelector('hp-dialog'); out.dialogWide = !!hpDialog?.hasAttribute('wide') && !!hpDialog.querySelector('.srcrow'); @@ -51,7 +54,7 @@ checkAll(res, { "filledClass": 1, "unfilled": 3, "tipTemp": 22.4, - "fillRadios": 5, + "fillRadios": 4, "tempInputs": 2, "dialogWidth": 500, });