Remove playlist items with their group
This commit is contained in:
1 parent
40f0892262
commit
64aeb1b47e
3 files changed
+30
-16
No files matched your search
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Removing a playlist group now removes all of its member slides.
|
||||||
- Replaced the canvas-size duplicate action with reversible disable/enable controls. Disabled sizes remain assigned to existing templates and playlists but cannot be selected for new ones.
|
- Replaced the canvas-size duplicate action with reversible disable/enable controls. Disabled sizes remain assigned to existing templates and playlists but cannot be selected for new ones.
|
||||||
|
|
||||||
## 2.15.2 - 2026-10-15
|
## 2.15.2 - 2026-10-15
|
||||||
|
|||||||
@@ -2895,22 +2895,7 @@
|
|||||||
}
|
}
|
||||||
var groupKey = String(header.getAttribute('data-group-key') || '');
|
var groupKey = String(header.getAttribute('data-group-key') || '');
|
||||||
getGroupRows(groupKey).forEach(function (row) {
|
getGroupRows(groupKey).forEach(function (row) {
|
||||||
var keyField = row.querySelector('[data-playlist-group-key]');
|
row.remove();
|
||||||
var nameField = row.querySelector('[data-playlist-group-name-value]');
|
|
||||||
var pickField = row.querySelector('[data-playlist-group-pick-count-value]');
|
|
||||||
var rulesField = row.querySelector('[data-playlist-group-schedule-rules]');
|
|
||||||
if (keyField) keyField.value = '';
|
|
||||||
if (nameField) nameField.value = '';
|
|
||||||
if (pickField) pickField.value = '1';
|
|
||||||
var shuffleField = row.querySelector('[data-playlist-group-shuffle-value]');
|
|
||||||
if (shuffleField) shuffleField.value = '0';
|
|
||||||
var modeField = row.querySelector('[data-playlist-group-mode-value]');
|
|
||||||
var repeatField = row.querySelector('[data-playlist-group-repeat-count-value]');
|
|
||||||
if (modeField) modeField.value = 'select';
|
|
||||||
if (repeatField) repeatField.value = '1';
|
|
||||||
if (rulesField) rulesField.value = '[]';
|
|
||||||
row.setAttribute('data-group-key', '');
|
|
||||||
row.classList.remove('playlist-group-child');
|
|
||||||
});
|
});
|
||||||
header.remove();
|
header.remove();
|
||||||
updateRowOrder(true);
|
updateRowOrder(true);
|
||||||
|
|||||||
@@ -105,6 +105,34 @@ test('playlist group colours differ, survive reorder, and clear on ungrouped sli
|
|||||||
assert.equal(firstMember.style['--playlist-group-bg'], undefined);
|
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', () => {
|
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 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];
|
const functionSource = source.match(/function updatePlaylistGroupEmptyRows\(\) \{[\s\S]*?\n \}/)[0];
|
||||||
|
|||||||
Reference in new issue
Block a user