mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Display the existing Select All and Select None controls when Multi-Selection is active in an existing Workspace. Keep selection scoped to boardsForView so search and the current Workspace determine exactly which rendered boards are selected. Thanks to xet7 !
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const js = fs.readFileSync(
|
|
path.join(root, 'client/components/boards/boardsList.js'),
|
|
'utf8',
|
|
);
|
|
const jade = fs.readFileSync(
|
|
path.join(root, 'client/components/boards/boardsList.jade'),
|
|
'utf8',
|
|
);
|
|
|
|
test('an existing Workspace shows Select All and Select None during Multi-Selection', () => {
|
|
const helperAt = js.indexOf(' showsBoardSelectionControls()');
|
|
const helper = js.slice(helperAt, js.indexOf('\n },', helperAt));
|
|
|
|
assert.match(helper, /Boolean\(tpl\.selectedWorkspaceIdVar\.get\(\)\)/);
|
|
assert.match(helper, /\(namedSection \|\| workspace\) && BoardMultiSelection\.isActive\(\)/);
|
|
assert.match(jade, /if showsBoardSelectionControls[\s\S]*?js-board-select-all[\s\S]*?js-board-select-none/);
|
|
});
|
|
|
|
test('Workspace Select All uses exactly the boards rendered by its current view', () => {
|
|
const eventAt = js.indexOf(" 'click .js-board-select-all'");
|
|
const event = js.slice(eventAt, js.indexOf('\n },', eventAt));
|
|
|
|
assert.match(event, /boardsForView\(tpl\)\.map\(board => board\._id\)/);
|
|
});
|
|
|
|
test('Select None clears the shared selection in a Workspace too', () => {
|
|
const eventAt = js.indexOf(" 'click .js-board-select-none'");
|
|
const event = js.slice(eventAt, js.indexOf('\n },', eventAt));
|
|
|
|
assert.match(event, /BoardMultiSelection\.reset\(\)/);
|
|
});
|