Remove playlist items with their group
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m11s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 30s

This commit is contained in:
lzstealth committed 2026-10-15 02:23:26 +01:00
1 parent 40f0892262
commit 64aeb1b47e
3 files changed
+30 -16

No files matched your search

+28
View File
@@ -105,6 +105,34 @@ test('playlist group colours differ, survive reorder, and clear on ungrouped sli
assert.equal(firstMember.style['--playlist-group-bg'], undefined);
});
test('removing a playlist group removes all of its member rows', () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'playlists', 'playlist-schedule.js'), 'utf8');
const functionSource = source.match(/function removePlaylistGroup\(header\) \{[\s\S]*?\n \}/)[0];
const removedRows = [];
let removedHeader = false;
let refreshedOrder = false;
const rows = [0, 1, 2].map((index) => ({ remove() { removedRows.push(index); } }));
const header = {
getAttribute(name) { return name === 'data-group-key' ? 'group-1' : null; },
remove() { removedHeader = true; }
};
const removeGroup = require('node:vm').runInNewContext('(' + functionSource + ')', {
getGroupRows(groupKey) {
assert.equal(groupKey, 'group-1');
return rows;
},
updateRowOrder(refresh) {
refreshedOrder = refresh;
}
});
removeGroup(header);
assert.deepEqual(removedRows, [0, 1, 2]);
assert.equal(removedHeader, true);
assert.equal(refreshedOrder, true);
});
test('empty playlist groups keep a drop area until a member is added', () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'playlists', 'playlist-schedule.js'), 'utf8');
const functionSource = source.match(/function updatePlaylistGroupEmptyRows\(\) \{[\s\S]*?\n \}/)[0];