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
@@ -38,6 +38,7 @@ function createResponse() {
|
||||
test('playlist create and update redirect to the canonical edit path', async () => {
|
||||
const calls = [];
|
||||
let groupInsertParams = null;
|
||||
let canvasSizeEnabled = 1;
|
||||
const connection = {
|
||||
async beginTransaction() {},
|
||||
async commit() {},
|
||||
@@ -76,7 +77,7 @@ test('playlist create and update redirect to the canonical edit path', async ()
|
||||
},
|
||||
common: {
|
||||
async fetchDuplicateName() { return null; },
|
||||
async fetchCanvasSizeById() { return { id: 7 }; },
|
||||
async fetchCanvasSizeById() { return { id: 7, enabled: canvasSizeEnabled }; },
|
||||
async fetchPlaylistById() { return { id: 4, canvas_id: 7 }; }
|
||||
},
|
||||
pages: {},
|
||||
@@ -161,6 +162,24 @@ test('playlist create and update redirect to the canonical edit path', async ()
|
||||
'insert-slide',
|
||||
{ kind: 'redirectAfterSave', url: '/playlists/4/edit', path: '/playlists/4' }
|
||||
]);
|
||||
|
||||
canvasSizeEnabled = 0;
|
||||
const disabledCreateRes = createResponse();
|
||||
await createHandlers[1]({
|
||||
path: '/playlists',
|
||||
body: { name: 'Disabled size playlist', canvas_size_id: '7', slide_id: [] }
|
||||
}, disabledCreateRes, (error) => { throw error; });
|
||||
assert.equal(disabledCreateRes.statusCode, 400);
|
||||
assert.equal(disabledCreateRes.body, 'Canvas size is disabled.');
|
||||
|
||||
const retainDisabledRes = createResponse();
|
||||
await updateHandlers[1]({
|
||||
path: '/playlists/4',
|
||||
params: { id: '4' },
|
||||
body: { name: 'Lunch Loop', canvas_size_id: '7', slide_id: [] }
|
||||
}, retainDisabledRes, (error) => { throw error; });
|
||||
assert.equal(retainDisabledRes.redirectedTo, '/playlists/4/edit');
|
||||
|
||||
for (const pickCount of ['0', '2']) {
|
||||
const invalidRes = createResponse();
|
||||
await updateHandlers[1]({
|
||||
|
||||
Reference in new issue
Block a user