Release v2.6.19

This commit is contained in:
2026-08-09 11:57:40 +01:00
parent 49c72923b4
commit 459f84ed94
34 changed files with 1650 additions and 256 deletions
+43 -21
View File
@@ -97,26 +97,9 @@ function createRow(startValue, endValue) {
return row;
}
function formatDateTimeLocalValue(date) {
function pad(value) {
return String(value).padStart(2, '0');
}
return [
String(date.getFullYear()).padStart(4, '0'),
'-',
pad(date.getMonth() + 1),
'-',
pad(date.getDate()),
'T',
pad(date.getHours()),
':',
pad(date.getMinutes())
].join('');
}
test('timetable group form highlights an end time that is too early', () => {
const row = createRow('2026-08-07T10:00', '2026-08-07T10:00');
const row = createRow('2026-08-07T12:00', '2026-08-07T12:00');
const timezoneInput = createInput('timezone', 'Europe/Berlin');
const body = {
rows: [row],
querySelectorAll(selector) {
@@ -140,7 +123,10 @@ test('timetable group form highlights an end time that is too early', () => {
};
const form = {
dataset: {},
addEventListener() {}
listeners: Object.create(null),
addEventListener(type, handler) {
this.listeners[type] = handler;
}
};
const templateRow = createRow('', '');
const template = {
@@ -161,6 +147,9 @@ test('timetable group form highlights an end time that is too early', () => {
if (id === 'timetable-group-form') {
return form;
}
if (id === 'timetable-group-timezone') {
return timezoneInput;
}
if (id === 'timetable-entry-row-template') {
return template;
}
@@ -194,14 +183,47 @@ test('timetable group form highlights an end time that is too early', () => {
const script = fs.readFileSync(scriptPath, 'utf8');
vm.runInNewContext(script, sandbox, { filename: scriptPath });
assert.equal(row.startInput.value, '2026-08-07T12:00');
assert.equal(row.endInput.value, '2026-08-07T12:00');
assert.equal(row.endInput.validityMessage, 'End time must be at least 1 minute after the start time.');
assert.equal(row.endInput.classList.contains('is-invalid'), true);
assert.equal(row.endInput.attributes['aria-invalid'], 'true');
row.endInput.value = formatDateTimeLocalValue(new Date(new Date(row.startInput.value).getTime() + 60000));
row.endInput.value = '2026-08-07T12:01';
row.endInput.dispatchEvent({ type: 'input' });
assert.equal(row.endInput.validityMessage, '');
assert.equal(row.endInput.classList.contains('is-invalid'), false);
assert.equal(Object.prototype.hasOwnProperty.call(row.endInput.attributes, 'aria-invalid'), false);
timezoneInput.value = 'Europe/London';
timezoneInput.dispatchEvent({ type: 'change' });
assert.equal(row.startInput.value, '2026-08-07T12:00');
assert.equal(row.endInput.value, '2026-08-07T12:01');
assert.equal(form.dataset.timetableTimezone, 'Europe/London');
assert.equal(form.dataset.dirty, 'true');
const formData = {
deleted: [],
appended: [],
delete(name) {
this.deleted.push(name);
},
append(name, value) {
this.appended.push([name, value]);
}
};
form.listeners.formdata({ formData: formData });
const startEntry = formData.appended.find(function (item) {
return item[0] === 'entry_start_datetime[]';
});
const endEntry = formData.appended.find(function (item) {
return item[0] === 'entry_end_datetime[]';
});
assert.equal(startEntry[1], '2026-08-07T11:00:00.000Z');
assert.equal(endEntry[1], '2026-08-07T11:01:00.000Z');
});