Add onboarding weather and template gradients
This commit is contained in:
+20
-1
@@ -6,7 +6,8 @@ require('../src/common');
|
||||
|
||||
const {
|
||||
buildTemplatePayload,
|
||||
extractTemplateRegions
|
||||
extractTemplateRegions,
|
||||
normalizeBackgroundGradient
|
||||
} = require('../src/data/templates');
|
||||
const renderTemplateAddPage = require('../src/web/routes/signage/templates/add');
|
||||
const renderTemplateEditPage = require('../src/web/routes/signage/templates/edit');
|
||||
@@ -81,6 +82,7 @@ test('buildTemplatePayload resolves canvas size and rejects duplicate region nam
|
||||
canvasSizeHeight: 720,
|
||||
backgroundImagePath: null,
|
||||
backgroundColor: '#111111',
|
||||
backgroundGradient: null,
|
||||
regions: [{
|
||||
region_key: 'Header',
|
||||
region_type: 'text',
|
||||
@@ -229,4 +231,21 @@ test('template designer warns when invalid region names block save', () => {
|
||||
assert.ok(script.includes("templateForm.addEventListener('invalid'"));
|
||||
assert.ok(script.includes('function notifyRegionNameValidationError(message)'));
|
||||
assert.ok(script.includes('regionNameValidationToastShown = false;'));
|
||||
});
|
||||
|
||||
test('normalizeBackgroundGradient accepts linear colors and clamps the angle', () => {
|
||||
assert.equal(normalizeBackgroundGradient(JSON.stringify({
|
||||
type: 'radial',
|
||||
colors: ['#123456', '#abcdef', '#fedcba'],
|
||||
angle: 400
|
||||
})), JSON.stringify({
|
||||
type: 'linear',
|
||||
stops: [
|
||||
{ color: '#123456', position: 0 },
|
||||
{ color: '#abcdef', position: 50 },
|
||||
{ color: '#fedcba', position: 100 }
|
||||
],
|
||||
angle: 360
|
||||
}));
|
||||
assert.equal(normalizeBackgroundGradient('{}'), null);
|
||||
});
|
||||
Reference in New Issue
Block a user