display proper time stamp on log message

This commit is contained in:
Pierre committed 2026-10-16 08:49:12 +02:00
1 parent bf72dbb223
commit 3b0c24e795
3 files changed
+5 -3

No files matched your search

+3 -1
View File
@@ -88,6 +88,7 @@ test('shows same-event log lines together with one causes link and keeps newer e
const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
const rows=alpha.querySelector('.rows'),combined=rows.children[0];
assert.ok(combined.classList.contains('event-log-group'));
assert.equal(combined.querySelector('.exact-time').textContent,trigger.timestamp);
assert.match(combined.querySelector('.row-message').textContent,/Callback trigger by sensor.kitchen_last_motion/);
assert.match(combined.querySelector('.row-message').textContent,/Triggered by \(sensor.kitchen_last_motion/);
assert.equal(combined.querySelectorAll('.link-hint').length,1);
@@ -172,7 +173,7 @@ test('distinguishes log lines from supplemental records when configured',()=>{
dom.window.close();
});
test('shows and refreshes relative time on each log entry while retaining exact time on hover',async()=>{
test('shows and refreshes relative time on each log entry while displaying exact time alongside it',async()=>{
const {dom,d,entries}=setup();
const entry=entries.find(e=>e.event_id==='a');
dom.window.Date.now=()=>entry.time+120000;
@@ -182,6 +183,7 @@ test('shows and refreshes relative time on each log entry while retaining exact
const row=[...d.querySelectorAll('[data-app="alpha"] .row')].find(item=>item.textContent.includes('Température déjà disponible'));
const relativeTime=()=>[...app.querySelectorAll('.row')].find(item=>item.textContent.includes('Température déjà disponible')).querySelector('.relative-time');
assert.equal(relativeTime().textContent,'2 minutes ago');
assert.equal(relativeTime().previousElementSibling.textContent,entries[3].timestamp);
assert.match(relativeTime().title,/10:00:10/);
dom.window.Date.now=()=>entry.time+3600000;
await new Promise(resolve=>setTimeout(resolve,1600));