test: update RBAC and table layout expectations

This commit is contained in:
lzstealth committed 2026-10-23 01:56:59 +01:00
1 parent 9c28eca3ef
commit 3ce4f70601
3 files changed
+14 -72

No files matched your search

+13 -61
View File
@@ -19,13 +19,15 @@ test('slide table thumbnails size to the canvas ratio and show the whole image',
assert.match(placeholderRule, /min-height:\s*0;/);
});
test('standalone slide thumbnails are centered within their table column', () => {
test('standalone slide thumbnail columns shrink to their content and keep thumbnails centered', () => {
const stylesheet = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'public', 'css', 'theme-custom.css'), 'utf8');
const columnRule = stylesheet.match(/^td\[data-label="Thumbnail"\] > \.playlist-slide-thumb\s*\{([^}]+)\}/m)[1];
const cellRule = stylesheet.match(/^\.card \.table td\[data-label="Thumbnail"\]\s*\{([^}]+)\}/m)[1];
assert.match(columnRule, /margin-inline:\s*auto;/);
assert.match(cellRule, /padding-inline:\s*1\.5rem;/);
assert.match(cellRule, /width:\s*1%;/);
assert.match(cellRule, /padding-inline:\s*0\.5rem;/);
assert.match(cellRule, /white-space:\s*nowrap;/);
});
test('mobile responsive tables keep descriptive columns wide enough for phrases', () => {
@@ -40,7 +42,7 @@ test('mobile responsive tables keep descriptive columns wide enough for phrases'
assert.match(mobileRule[2], /overflow-wrap:\s*break-word;/);
});
test('table pagination cards skip the minimum height for short content', () => {
function createPaginationHarness(scrollHeight) {
const cardStyle = {
properties: {},
setProperty(name, value) {
@@ -53,7 +55,7 @@ test('table pagination cards skip the minimum height for short content', () => {
const card = {
style: cardStyle,
scrollHeight: 200,
scrollHeight,
getBoundingClientRect() {
return { top: 100 };
}
@@ -99,69 +101,19 @@ test('table pagination cards skip the minimum height for short content', () => {
const script = fs.readFileSync(scriptPath, 'utf8');
vm.runInNewContext(script, sandbox, { filename: scriptPath });
return { cardStyle, bodyClassList };
}
test('table pagination cards skip the minimum height for short content', () => {
const { cardStyle, bodyClassList } = createPaginationHarness(200);
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 });
const { cardStyle, bodyClassList } = createPaginationHarness(640);
assert.equal(cardStyle.properties['--table-pagination-card-min-height'], '320px');
assert.equal(cardStyle.properties['--table-pagination-card-max-height'], '320px');