25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
|
|
const {test} = require('node:test');
|
||
|
|
const assert = require('node:assert/strict');
|
||
|
|
const fs = require('node:fs');
|
||
|
|
|
||
|
|
const source = fs.readFileSync('static/js/work-desk.js', 'utf8');
|
||
|
|
const template = fs.readFileSync('app/modules/planner/templates/desk.html', 'utf8');
|
||
|
|
|
||
|
|
test('desk pressure names every affected task and provides a focus action', () => {
|
||
|
|
assert.match(source, /function attentionReasons\(/);
|
||
|
|
assert.match(source, /Mangler \$\{fmt\(row\.missing_minutes\)\} i planen/);
|
||
|
|
assert.match(source, /data-attention-case/);
|
||
|
|
assert.match(source, /scrollIntoView\(\{behavior:'smooth',block:'center'\}\)/);
|
||
|
|
assert.match(source, /Kapacitet:<\/strong> Dagens arbejde overstiger/);
|
||
|
|
assert.match(template, /id="deskPressure" class="alert alert-warning desk-pressure" role="alert"/);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('overdue task rows receive a visible state and non-color label', () => {
|
||
|
|
assert.match(source, /const overdue=Boolean\(r\.deadline && new Date\(r\.deadline\)<now\)/);
|
||
|
|
assert.match(source, /desk-task-overdue/);
|
||
|
|
assert.match(source, /visually-hidden">Deadline overskredet:/);
|
||
|
|
const css = fs.readFileSync('static/css/work-desk.css', 'utf8');
|
||
|
|
assert.match(css, /\.desk-table tr\.desk-task-overdue td\{background:/);
|
||
|
|
assert.match(css, /box-shadow:inset 4px 0 #dc3545/);
|
||
|
|
});
|