mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-28 19:01:34 +00:00
41 lines
2.3 KiB
JavaScript
41 lines
2.3 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const source = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8');
|
|
|
|
test('#582 camera movement switches the day-cycle shadow to a stage-bounded scene', () => {
|
|
const helper = source('src/render/paper-scene.ts');
|
|
const card = source('src/houseplan-card.ts');
|
|
const staticRender = source('src/space-render.ts');
|
|
const styles = source('src/styles/plan.styles.ts');
|
|
|
|
assert.match(helper, /function renderPaperShapes/);
|
|
assert.match(helper, /pointer-events="none"/);
|
|
assert.match(card, /dayCycle && paperShapes\.length \? svg`<svg class="hp-paper-outline-svg"/);
|
|
assert.match(card, /data-hp-live-viewbox=\$\{iso \? 'camera' : 'floor'\}/);
|
|
assert.match(card, /renderPaperShapes\(paperShapes\)/);
|
|
assert.match(staticRender, /renderPaperShapes\(paperShapes\)/);
|
|
assert.match(staticRender, /dayCycle && paperShapes\.length \? svg`<svg class="hp-paper-outline-svg"/);
|
|
assert.match(card, /private _activateSafeDayCycleOutline\(\)/);
|
|
assert.match(card, /hp-safe-daycycle-outline/);
|
|
assert.match(card, /private _startCameraTransition\([\s\S]*?this\._activateSafeDayCycleOutline\(\);[\s\S]*?this\._cameraTransition\.start/);
|
|
assert.match(styles, /\.stage\.daycycle \.hp-paperg/);
|
|
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.hp-paper-outline-svg/);
|
|
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.hp-paperg \{[\s\S]*?filter:\s*none;[\s\S]*?will-change:\s*auto;/);
|
|
});
|
|
|
|
test('#582 safe camera scene uses explicit bounded plan and outline layers', () => {
|
|
const card = source('src/houseplan-card.ts');
|
|
const styles = source('src/styles/plan.styles.ts');
|
|
const staticCard = source('src/space-card.ts');
|
|
|
|
assert.match(card, /<svg class="plan-svg"/);
|
|
assert.match(styles, /\.plan-svg \{ z-index: 1; \}/);
|
|
assert.match(styles, /\.hp-paper-outline-svg \{[\s\S]*?z-index: 0;/);
|
|
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.plan-svg \{[\s\S]*?will-change:\s*transform;/);
|
|
assert.match(staticCard, /\.hp-static-stage > \.hp-paper-outline-svg \{[\s\S]*?z-index:\s*0;/);
|
|
assert.match(styles, /\.hp-static-stage\.daycycle \.hp-paper-outline-svg/);
|
|
assert.match(styles, /\.hp-static-stage\.daycycle \.hp-paperg \{[\s\S]*?filter:\s*none;[\s\S]*?will-change:\s*auto;/);
|
|
});
|