Add canvas size disable controls
This commit is contained in:
1 parent
68e1f80190
commit
f0601f823d
22 files changed
+205
-87
No files matched your search
@@ -124,6 +124,30 @@ test('buildTemplatePayload resolves canvas size and rejects duplicate region nam
|
||||
);
|
||||
});
|
||||
|
||||
test('disabled canvas sizes cannot be assigned to new templates but existing assignments can be retained', async () => {
|
||||
const pool = {
|
||||
async query() {
|
||||
return [[{ id: 4, name: 'Legacy', width: 1280, height: 720, enabled: 0 }]];
|
||||
}
|
||||
};
|
||||
const req = {
|
||||
body: {
|
||||
name: 'Legacy template',
|
||||
canvas_size_id: '4',
|
||||
regions_json: JSON.stringify([{ region_name: 'Body', region_type: 'text' }])
|
||||
},
|
||||
files: []
|
||||
};
|
||||
|
||||
await assert.rejects(
|
||||
() => buildTemplatePayload(pool, req, null),
|
||||
(error) => error && error.statusCode === 400 && error.message === 'Canvas size is disabled.'
|
||||
);
|
||||
|
||||
const payload = await buildTemplatePayload(pool, req, { canvas_size_id: 4 });
|
||||
assert.equal(payload.canvasSizeId, 4);
|
||||
});
|
||||
|
||||
test('buildDuplicateTemplate copies template fields and strips row identity', () => {
|
||||
const duplicate = buildDuplicateTemplate({
|
||||
id: 9,
|
||||
|
||||
Reference in new issue
Block a user