mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-03 05:08:53 +00:00
New setting 'background around the plan' (#rrggbb): - global: config.settings.bg_color, edited in the gear dialog with a live preview and a 'theme default' reset (empty = keep the stylesheet default); - per-space override in the space dialog next to the room colors, empty = inherit the general setting (the show_lqi/fill_mode pattern); - applied to the stage in view and kiosk modes (editors keep their own canvas) and to the static houseplan-space-card; - backend validates both keys with the same strict #rrggbb match as room_color; garbage strings are rejected (test_bg_color_setting). smoke_bg_color covers apply/override/inherit/reset, dialog previews, the wire format of the cleared override, kiosk and the static card.
38 lines
2.1 KiB
JavaScript
38 lines
2.1 KiB
JavaScript
import { launch, checkAll, finish } from './serve.mjs';
|
||
const { page, browser } = await launch();
|
||
const res = await page.evaluate(async () => {
|
||
const out = {};
|
||
const c = window.__card;
|
||
const sr = () => c.shadowRoot || c.renderRoot;
|
||
// 1) диалог общих настроек: 7 цветовых строк, 3 группы
|
||
c._openSettingsDialog(); await c.updateComplete;
|
||
out.rows = sr().querySelectorAll('.gsrow').length;
|
||
out.groups = [...sr().querySelectorAll('.dialog .dispsection')].map((l) => l.textContent.trim());
|
||
// 2) сменить цвет light_on и сохранить
|
||
c._setFillColor('light_on', { c: '#ff00ff', a: 0.5 });
|
||
await c._saveSettingsDialog(); await c.updateComplete;
|
||
out.saved = c._serverCfg.settings.fill_colors?.light_on;
|
||
// 3) заливка light использует кастомный цвет
|
||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : ({ ...s,
|
||
settings: { ...(s.settings||{}), show_borders: true, fill_mode: 'light' } })) };
|
||
c.requestUpdate(); await c.updateComplete;
|
||
const styles = [...sr().querySelectorAll('.room.styled')].map((r) => r.getAttribute('style') || '');
|
||
out.customFillUsed = styles.some((st) => st.includes('#ff00ff') && st.includes('0.500'));
|
||
// 4) show_lqi=false у пространства скрывает LQI-бейджи
|
||
out.lqiBefore = sr().querySelectorAll('.dev .lqi').length;
|
||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : ({ ...s,
|
||
settings: { ...(s.settings||{}), show_lqi: false } })) };
|
||
c.requestUpdate(); await c.updateComplete;
|
||
out.lqiAfter = sr().querySelectorAll('.dev .lqi').length;
|
||
return out;
|
||
});
|
||
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
|
||
checkAll(res, {
|
||
"rows": 12, // 10 цветов + радиус свечения + фон вокруг плана
|
||
"groups": ["Fill: lights", "Fill: temperature", "Fill: zigbee signal", "Light-sources fill", "Stage background"],
|
||
"saved": {"c": "#ff00ff", "a": 0.5},
|
||
"lqiBefore": 7,
|
||
"lqiAfter": 0,
|
||
});
|
||
await finish(browser, res);
|