From 044a9b6de696e2a1ae0ebd57166faf424fe065a5 Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:10:34 +0200 Subject: [PATCH 1/2] Only show autoscroll option whilst live mode is running Hides the autoscroll checkbox unless live mode is actively running. --- InfoLogger/public/log/statusBar.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/InfoLogger/public/log/statusBar.js b/InfoLogger/public/log/statusBar.js index 79e08f66f..3d99f4198 100644 --- a/InfoLogger/public/log/statusBar.js +++ b/InfoLogger/public/log/statusBar.js @@ -90,18 +90,20 @@ const applicationMessage = (model) => model.log.list.length > model.log.applicat : null; /** - * Show some application preferences: auto-scroll and inspector checkboxes + * Show some application preferences: inspector checkbox, plus autoscroll whilst live mode is running * (could be evolve into a preference panel in the future if more options are added) * @param {Model} model - root model of the application * @returns {vnode} - the view of the application options */ const applicationOptions = (model) => [ - h('label.d-inline', { title: 'Scroll down in live mode on new log incoming' }, h('input', { - type: 'checkbox', - checked: model.log.autoScrollLive, - onchange: () => model.log.toggleAutoScroll(), - }), ' Autoscroll'), - h('span.mh1'), + model.log.isLiveModeRunning() && [ + h('label.d-inline', { title: 'Scroll down in live mode on new log incoming' }, h('input', { + type: 'checkbox', + checked: model.log.autoScrollLive, + onchange: () => model.log.toggleAutoScroll(), + }), ' Autoscroll'), + h('span.mh1'), + ], h('label.d-inline', { title: 'Show details of selected log' }, h('input', { type: 'checkbox', checked: model.inspectorEnabled, From 8a6efcb69aea9b5aed32faeac289b640597d6c9a Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:15:06 +0200 Subject: [PATCH 2/2] Adds tests to cover this hiding/showing in each mode --- InfoLogger/test/public/status-bar-mocha.js | 54 +++++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/InfoLogger/test/public/status-bar-mocha.js b/InfoLogger/test/public/status-bar-mocha.js index 3c0d46609..4080ae337 100644 --- a/InfoLogger/test/public/status-bar-mocha.js +++ b/InfoLogger/test/public/status-bar-mocha.js @@ -319,14 +319,56 @@ describe('Status Bar test-suite', async () => { }); describe('Application Options', () => { - it('should toggle autoscroll when its checkbox is clicked', async () => { - await page.click(AUTOSCROLL_SELECTOR); + describe('Autoscroll', () => { + describe('in query mode', () => { + it('should not display autoscroll option when in MODE.QUERY', async () => { + await page.evaluate(() => model.log.liveStop()); + await page.waitForFunction( + (selector) => !document.querySelector(selector), + { timeout: 2000 }, + AUTOSCROLL_SELECTOR, + ); + }); + }); - const checkedAfter = await page.$eval(AUTOSCROLL_SELECTOR, (el) => el.checked); - const autoScrollModelValue = await page.evaluate(() => window.model.log.autoScrollLive); + describe('in live mode', () => { + beforeEach(async () => { + await page.evaluate(() => model.log.liveStop()); + await page.waitForSelector('#live-button:not([disabled])'); + await page.click('#live-button'); + await page.waitForFunction(() => model.log.isLiveModeRunning()); + }); - assert.strictEqual(autoScrollModelValue, checkedAfter); - assert.strictEqual(checkedAfter, true); + after(async () => { + await page.evaluate(() => model.log.liveStop()); + }); + + it('should not display autoscroll option when in MODE.LIVE.PAUSED', async () => { + await page.click('#live-button'); + + await page.waitForFunction( + (selector) => !document.querySelector(selector), + { timeout: 2000 }, + AUTOSCROLL_SELECTOR, + ); + }); + + it('should display autoscroll option when in MODE.LIVE.RUNNING', async () => { + await page.waitForSelector(AUTOSCROLL_SELECTOR, { timeout: 2000 }); + }); + + it('should toggle autoscroll when its checkbox is clicked', async () => { + await page.waitForSelector(AUTOSCROLL_SELECTOR, { timeout: 2000 }); + const checkedBefore = await page.$eval(AUTOSCROLL_SELECTOR, (el) => el.checked); + await page.click(AUTOSCROLL_SELECTOR); + + const checkedAfter = await page.$eval(AUTOSCROLL_SELECTOR, (el) => el.checked); + const autoScrollModelValue = await page.evaluate(() => model.log.autoScrollLive); + + assert.strictEqual(checkedAfter, !checkedBefore); + assert.strictEqual(autoScrollModelValue, checkedAfter); + }); + }); }); it('should toggle inspector when its checkbox is clicked', async () => {