Add player control-plane and dashboard updates

This commit is contained in:
2026-08-07 22:35:27 +01:00
parent a4f8a807ff
commit 2bd47fb96a
36 changed files with 5081 additions and 263 deletions
+133
View File
@@ -0,0 +1,133 @@
const fs = require('node:fs');
const path = require('node:path');
const vm = require('node:vm');
const test = require('node:test');
const assert = require('node:assert/strict');
test('table pagination cards skip the minimum height for short content', () => {
const cardStyle = {
properties: {},
setProperty(name, value) {
this.properties[name] = String(value);
},
removeProperty(name) {
delete this.properties[name];
}
};
const card = {
style: cardStyle,
scrollHeight: 200,
getBoundingClientRect() {
return { top: 100 };
}
};
const bodyClassList = {
toggled: null,
toggle(name, value) {
this.toggled = { name, value };
}
};
const sandbox = {
document: {
body: {
classList: bodyClassList
},
querySelector(selector) {
return selector === '[data-table-pagination-card]' ? card : null;
},
querySelectorAll(selector) {
return selector === '[data-table-pagination-card]' ? [card] : [];
}
},
window: null,
URL,
console,
setTimeout,
clearTimeout
};
sandbox.window = Object.assign(sandbox, {
innerHeight: 280,
addEventListener() {},
clearTimeout,
setTimeout,
requestAnimationFrame(callback) {
callback();
}
});
const scriptPath = path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'table', 'table-search.js');
const script = fs.readFileSync(scriptPath, 'utf8');
vm.runInNewContext(script, sandbox, { filename: scriptPath });
assert.equal(cardStyle.properties['--table-pagination-card-min-height'], undefined);
assert.equal(cardStyle.properties['--table-pagination-card-max-height'], '320px');
assert.deepEqual(bodyClassList.toggled, { name: 'table-pagination-page', value: true });
});
test('table pagination cards keep the minimum height for tall content', () => {
const cardStyle = {
properties: {},
setProperty(name, value) {
this.properties[name] = String(value);
},
removeProperty(name) {
delete this.properties[name];
}
};
const card = {
style: cardStyle,
scrollHeight: 640,
getBoundingClientRect() {
return { top: 100 };
}
};
const bodyClassList = {
toggled: null,
toggle(name, value) {
this.toggled = { name, value };
}
};
const sandbox = {
document: {
body: {
classList: bodyClassList
},
querySelector(selector) {
return selector === '[data-table-pagination-card]' ? card : null;
},
querySelectorAll(selector) {
return selector === '[data-table-pagination-card]' ? [card] : [];
}
},
window: null,
URL,
console,
setTimeout,
clearTimeout
};
sandbox.window = Object.assign(sandbox, {
innerHeight: 280,
addEventListener() {},
clearTimeout,
setTimeout,
requestAnimationFrame(callback) {
callback();
}
});
const scriptPath = path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'table', 'table-search.js');
const script = fs.readFileSync(scriptPath, 'utf8');
vm.runInNewContext(script, sandbox, { filename: scriptPath });
assert.equal(cardStyle.properties['--table-pagination-card-min-height'], '320px');
assert.equal(cardStyle.properties['--table-pagination-card-max-height'], '320px');
assert.deepEqual(bodyClassList.toggled, { name: 'table-pagination-page', value: true });
});