mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
Release v1.62.0-beta.8 candidate
Issue: #75 Issue: #76 Issue: #95 User-Visible: yes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { deviceFaceStyle } from '../test-build/device-face.js';
|
||||
import {
|
||||
deviceFaceStyle, legacySupplementalMetrics, lqiClassName, valueBadgeClassName,
|
||||
} from '../test-build/device-face.js';
|
||||
|
||||
const face = (rippleColor) => ({
|
||||
display: 'icon_ripple', scale: 1,
|
||||
@@ -21,3 +23,39 @@ test('device face never emits an arbitrary persisted ripple declaration', () =>
|
||||
assert.deepEqual(hostile, ['--ripple-scale:3']);
|
||||
assert.ok(!hostile.join(';').includes('position'));
|
||||
});
|
||||
|
||||
test('untouched legacy temperature and humidity keep the second satellite', () => {
|
||||
const presentation = {
|
||||
valueBadge: {
|
||||
configured: false,
|
||||
source: { kind: 'temperature', eid: 'sensor.temp' },
|
||||
tone: 'temperature',
|
||||
},
|
||||
tempText: '22.4',
|
||||
humText: '48',
|
||||
};
|
||||
assert.deepEqual(legacySupplementalMetrics(presentation), [
|
||||
{ kind: 'humidity', text: '48', suffix: '%' },
|
||||
]);
|
||||
assert.deepEqual(legacySupplementalMetrics({
|
||||
...presentation,
|
||||
valueBadge: { ...presentation.valueBadge, configured: true },
|
||||
}), []);
|
||||
});
|
||||
|
||||
test('value badge classes cover all four positions and only bottom displaces LQI', () => {
|
||||
for (const position of ['right', 'bottom', 'left', 'top']) {
|
||||
const badge = {
|
||||
position, availability: 'available', tone: 'default',
|
||||
};
|
||||
assert.equal(
|
||||
valueBadgeClassName(badge),
|
||||
`value-badge pos-${position} available tone-default`,
|
||||
);
|
||||
assert.equal(
|
||||
lqiClassName(badge),
|
||||
position === 'bottom' ? 'lqi below-value-badge' : 'lqi',
|
||||
);
|
||||
}
|
||||
assert.equal(lqiClassName(null), 'lqi');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user