From c50b678a8c36b70e0d32f291c0112997fced8fc8 Mon Sep 17 00:00:00 2001 From: sumairq Date: Sun, 26 Jul 2026 08:12:58 +0500 Subject: [PATCH 1/8] Add signPrefix and formatNumberFixedTwo helpers --- src/utils/format.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/utils/format.ts b/src/utils/format.ts index b0e2aec2f..b9d588af3 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -4,6 +4,12 @@ const dateFormatter = new Intl.DateTimeFormat('en-US', { const numberFormatter = new Intl.NumberFormat('en-US'); +// Groups thousands while keeping exactly 2 decimals (e.g. 2,113.69). +const numberFormatterFixedTwo = new Intl.NumberFormat('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, +}); + export function formatDate(date: Date) { return dateFormatter.format(date); } @@ -16,6 +22,13 @@ export const formatNumber = (value: number) => { return numberFormatter.format(value); }; +// Returns a leading "+" for positive values only (negatives already carry "-"). +export const signPrefix = (value: number) => (value > 0 ? '+' : ''); + +export const formatNumberFixedTwo = (value: number) => { + return numberFormatterFixedTwo.format(value); +}; + // Determine the best human-readable scale for a unit given a set of values. // Returns the divisor and display unit label; suitable for axis tick formatting. export function getDisplayScale( From 3f42e9fc0154dceae685541da21c60f348f307ef Mon Sep 17 00:00:00 2001 From: sumairq Date: Sun, 26 Jul 2026 08:14:33 +0500 Subject: [PATCH 2/8] Show explicit +/- sign on Delta percentage columns --- .../CompareResults/ResultsTable.test.tsx | 332 +++++++++--------- .../SubtestsResultsView.test.tsx | 148 ++++---- .../SubtestsRevisionRow.test.tsx | 2 +- .../__snapshots__/ResultsTable.test.tsx.snap | 44 +-- .../SubtestsResultsView.test.tsx.snap | 30 +- .../SubtestsRevisionRow.test.tsx.snap | 4 +- src/common/testVersions/mannWhitney.tsx | 6 +- src/common/testVersions/studentT.tsx | 20 +- 8 files changed, 295 insertions(+), 291 deletions(-) diff --git a/src/__tests__/CompareResults/ResultsTable.test.tsx b/src/__tests__/CompareResults/ResultsTable.test.tsx index c663ada1d..d0e2c9615 100644 --- a/src/__tests__/CompareResults/ResultsTable.test.tsx +++ b/src/__tests__/CompareResults/ResultsTable.test.tsx @@ -203,9 +203,9 @@ describe('Results Table', () => { expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' rev: devilrabbit', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); expect(screen.getByRole('rowgroup')).toMatchSnapshot(); }); @@ -229,10 +229,10 @@ describe('Results Table', () => { await screen.findByText('a11yr'); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - inexistant, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - inexistant, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -243,9 +243,9 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Windows/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'linux', 'android', 'ios'], @@ -256,10 +256,10 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Windows/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - inexistant, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - inexistant, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -269,8 +269,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Linux/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'android', 'ios'], @@ -279,9 +279,9 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Linux/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'android', 'ios', 'linux'], @@ -290,10 +290,10 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', 'Select all values'); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - inexistant, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', + ' - inexistant, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -302,8 +302,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /macOS/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Android, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -314,7 +314,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Android/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -325,7 +325,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Platform', /Select only.*Android/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, Improvement, 1.08 %, Low', + ' - Android, Improvement, +1.08 %, Low', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['android'], @@ -339,8 +339,8 @@ describe('Results Table', () => { await screen.findByText('a11yr'); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -350,8 +350,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Status', /No changes/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['improvement', 'regression'], @@ -361,7 +361,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Status', /Improvement/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -382,7 +382,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Status', /Select only.*Regression/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Linux 18.04, Regression, +1.85 %, Medium', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['regression'], @@ -396,8 +396,8 @@ describe('Results Table', () => { await screen.findByText('a11yr'); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -407,7 +407,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Confidence', /Low/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -418,7 +418,7 @@ describe('Results Table', () => { await clickMenuItem(user, 'Confidence', /High/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -24 %, -', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ @@ -437,8 +437,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Confidence', /Select all values/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -447,8 +447,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Confidence', /No value/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -2.4 %, High', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ @@ -459,8 +459,8 @@ describe('Results Table', () => { await clickMenuItem(user, 'Confidence', /No value/); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -486,7 +486,7 @@ describe('Results Table', () => { expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime }); expect(await summarizeTableFiltersFromCheckboxes(user)).toEqual({ @@ -514,24 +514,24 @@ describe('Results Table', () => { expect(summarizeVisibleRows()).toEqual([ 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', - ' - Linux 18.04, Regression, 1.97 %, Medium', - ' - macOS 10.15, Improvement, 1.2 %, Low', + ' - Linux 18.04, Regression, +1.97 %, Medium', + ' - macOS 10.15, Improvement, +1.2 %, Low', ' - Windows 10, -, -23.88 %, -', ' - Windows 10, -, -2.28 %, High', ' rev: tictactoe', - ' - Linux 18.04, Regression, 2.05 %, Medium', - ' - macOS 10.15, Improvement, 1.28 %, Low', + ' - Linux 18.04, Regression, +2.05 %, Medium', + ' - macOS 10.15, Improvement, +1.28 %, Low', ' - Windows 10, -, -23.8 %, -', ' - Windows 10, -, -2.2 %, High', 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ' rev: tictactoe', - ' - Linux 18.04, Regression, 1.93 %, Medium', - ' - macOS 10.15, Improvement, 1.16 %, Low', + ' - Linux 18.04, Regression, +1.93 %, Medium', + ' - macOS 10.15, Improvement, +1.16 %, Low', ' - Windows 10, -, -23.92 %, -', ' - Windows 10, -, -2.32 %, High', ]); @@ -548,24 +548,24 @@ describe('Results Table', () => { ' rev: spam', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' rev: tictactoe', ' - Windows 10, -, -23.92 %, -', ' - Windows 10, -, -2.32 %, High', - ' - Linux 18.04, Regression, 1.93 %, Medium', - ' - macOS 10.15, Improvement, 1.16 %, Low', + ' - Linux 18.04, Regression, +1.93 %, Medium', + ' - macOS 10.15, Improvement, +1.16 %, Low', 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -, -23.88 %, -', ' - Windows 10, -, -2.28 %, High', - ' - Linux 18.04, Regression, 1.97 %, Medium', - ' - macOS 10.15, Improvement, 1.2 %, Low', + ' - Linux 18.04, Regression, +1.97 %, Medium', + ' - macOS 10.15, Improvement, +1.2 %, Low', ' rev: tictactoe', ' - Windows 10, -, -23.8 %, -', ' - Windows 10, -, -2.2 %, High', - ' - Linux 18.04, Regression, 2.05 %, Medium', - ' - macOS 10.15, Improvement, 1.28 %, Low', + ' - Linux 18.04, Regression, +2.05 %, Medium', + ' - macOS 10.15, Improvement, +1.28 %, Low', ]); // It should have the "descending" SVG. expect(deltaButton).toMatchSnapshot(); @@ -577,24 +577,24 @@ describe('Results Table', () => { expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', - ' - macOS 10.15, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -2.4 %, High', ' - Windows 10, -, -24 %, -', ' rev: tictactoe', - ' - macOS 10.15, Improvement, 1.16 %, Low', - ' - Linux 18.04, Regression, 1.93 %, Medium', + ' - macOS 10.15, Improvement, +1.16 %, Low', + ' - Linux 18.04, Regression, +1.93 %, Medium', ' - Windows 10, -, -2.32 %, High', ' - Windows 10, -, -23.92 %, -', 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', - ' - macOS 10.15, Improvement, 1.2 %, Low', - ' - Linux 18.04, Regression, 1.97 %, Medium', + ' - macOS 10.15, Improvement, +1.2 %, Low', + ' - Linux 18.04, Regression, +1.97 %, Medium', ' - Windows 10, -, -2.28 %, High', ' - Windows 10, -, -23.88 %, -', ' rev: tictactoe', - ' - macOS 10.15, Improvement, 1.28 %, Low', - ' - Linux 18.04, Regression, 2.05 %, Medium', + ' - macOS 10.15, Improvement, +1.28 %, Low', + ' - Linux 18.04, Regression, +2.05 %, Medium', ' - Windows 10, -, -2.2 %, High', ' - Windows 10, -, -23.8 %, -', ]); @@ -612,24 +612,24 @@ describe('Results Table', () => { 'a11yr aria.html opt e10s fission stylo webrender', ' rev: tictactoe', ' - Windows 10, -, -2.2 %, High', - ' - Linux 18.04, Regression, 2.05 %, Medium', - ' - macOS 10.15, Improvement, 1.28 %, Low', + ' - Linux 18.04, Regression, +2.05 %, Medium', + ' - macOS 10.15, Improvement, +1.28 %, Low', ' - Windows 10, -, -23.8 %, -', ' rev: spam', ' - Windows 10, -, -2.28 %, High', - ' - Linux 18.04, Regression, 1.97 %, Medium', - ' - macOS 10.15, Improvement, 1.2 %, Low', + ' - Linux 18.04, Regression, +1.97 %, Medium', + ' - macOS 10.15, Improvement, +1.2 %, Low', ' - Windows 10, -, -23.88 %, -', 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: tictactoe', ' - Windows 10, -, -2.32 %, High', - ' - Linux 18.04, Regression, 1.93 %, Medium', - ' - macOS 10.15, Improvement, 1.16 %, Low', + ' - Linux 18.04, Regression, +1.93 %, Medium', + ' - macOS 10.15, Improvement, +1.16 %, Low', ' - Windows 10, -, -23.92 %, -', ' rev: spam', ' - Windows 10, -, -2.4 %, High', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ]); // It should have the "no sort" SVG. @@ -651,8 +651,8 @@ describe('Results Table', () => { expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - macOS 10.15, Improvement, 1.08 %, Low', - ' - Linux 18.04, Regression, 1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', ' - Windows 10, -, -2.4 %, High', ' - Windows 10, -, -24 %, -', ]); @@ -662,8 +662,8 @@ describe('Results Table', () => { await user.click(deltaButton); expect(summarizeVisibleRows()).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', ]); @@ -683,8 +683,8 @@ describe('Results Table', () => { 'a11yr dhtml.html spam opt e10s fission stylo webrender', ' - Windows 10, -, -24 %, -', ' - Windows 10, -, -2.4 %, High', - ' - Linux 18.04, Regression, 1.85 %, Medium', - ' - macOS 10.15, Improvement, 1.08 %, Low', + ' - Linux 18.04, Regression, +1.85 %, Medium', + ' - macOS 10.15, Improvement, +1.08 %, Low', ]); }); }); @@ -722,9 +722,9 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' rev: devilrabbit', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(screen.getByRole('rowgroup')).toMatchSnapshot(); }); @@ -748,10 +748,10 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await screen.findByText('a11yr'); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - inexistant, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - inexistant, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -762,9 +762,9 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Windows/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'linux', 'android', 'ios'], @@ -775,10 +775,10 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Windows/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - inexistant, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - inexistant, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -788,8 +788,8 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Linux/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'android', 'ios'], @@ -798,9 +798,9 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Linux/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['osx', 'android', 'ios', 'linux'], @@ -809,10 +809,10 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', 'Select all values'); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - inexistant, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - inexistant, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -821,8 +821,8 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /macOS/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -833,7 +833,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Android/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -844,7 +844,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Platform', /Select only.*Android/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Android, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Android, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ platform: ['android'], @@ -883,8 +883,8 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await screen.findByText('a11yr'); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -894,8 +894,8 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /No changes/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['improvement', 'regression'], @@ -904,7 +904,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /Improvement/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['regression'], @@ -914,7 +914,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /Regression/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -925,8 +925,8 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /Regression/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -935,7 +935,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /Select only.*Regression/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['regression'], @@ -944,7 +944,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio await clickMenuItem(user, 'Status', /Select only.*Improvement/); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); expect(summarizeTableFiltersFromUrl()).toEqual({ status: ['improvement'], @@ -961,7 +961,7 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr dhtml.html spam opt e10s fission stylo webrender', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ]); const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime }); expect(await summarizeTableFiltersFromCheckboxes(user)).toEqual({ @@ -997,24 +997,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', ' - Windows 10, -, , 1.2, , 99.00 %', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', ' rev: tictactoe', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', ' - Windows 10, -, , 2, , 98.00 %', ' - Windows 10, -2.401 %, , 2, , 48.00 %', 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ' rev: tictactoe', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', ' - Windows 10, -, , 0.8, , 99.00 %', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', ]); @@ -1028,24 +1028,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr aria.html opt e10s fission stylo webrender', ' rev: tictactoe', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', ' - Windows 10, -2.401 %, , 2, , 48.00 %', ' - Windows 10, -, , 2, , 98.00 %', ' rev: spam', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', ' - Windows 10, -, , 1.2, , 99.00 %', 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: tictactoe', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', ' - Windows 10, -, , 0.8, , 99.00 %', ' rev: spam', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ' - Windows 10, -, , -, , 100.00 %', ]); @@ -1062,24 +1062,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ 'a11yr aria.html opt e10s fission stylo webrender', ' rev: tictactoe', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', ' - Windows 10, -, , 2, , 98.00 %', ' - Windows 10, -2.401 %, , 2, , 48.00 %', ' rev: spam', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', ' - Windows 10, -, , 1.2, , 99.00 %', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: tictactoe', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', ' - Windows 10, -, , 0.8, , 99.00 %', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', ' rev: spam', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' - Windows 10, -, , -, , 100.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ]); @@ -1095,24 +1095,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio ' rev: spam', ' - Windows 10, -2.401 %, , -, , 50.00 %', ' - Windows 10, -, , -, , 100.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' rev: tictactoe', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', ' - Windows 10, -, , 0.8, , 99.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', ' - Windows 10, -, , 1.2, , 99.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', ' rev: tictactoe', ' - Windows 10, -2.401 %, , 2, , 48.00 %', ' - Windows 10, -, , 2, , 98.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', ]); // It should have the "descending" SVG. expect(significanceButton).toMatchSnapshot(); @@ -1128,24 +1128,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -, , -, , 100.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', ' - Windows 10, -2.401 %, , -, , 50.00 %', ' rev: tictactoe', ' - Windows 10, -, , 0.8, , 99.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -, , 1.2, , 99.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', ' rev: tictactoe', ' - Windows 10, -, , 2, , 98.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', ' - Windows 10, -2.401 %, , 2, , 48.00 %', ]); @@ -1159,24 +1159,24 @@ describe('Results Table for MannWhitneyResultsItem for mann-whitney-u testVersio 'a11yr dhtml.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -2.401 %, , -, , 50.00 %', - ' - Linux 18.04, 1.849 %, Regression, -, -, 45.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.1, -, 25.00 %', + ' - Linux 18.04, +1.849 %, Regression, -, -, 45.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.1, -, 25.00 %', ' - Windows 10, -, , -, , 100.00 %', ' rev: tictactoe', ' - Windows 10, -2.401 %, , 0.8, , 49.00 %', - ' - Linux 18.04, 1.849 %, Regression, 0.8, -, 44.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 0.9, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 0.8, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 0.9, -, 24.00 %', ' - Windows 10, -, , 0.8, , 99.00 %', 'a11yr aria.html opt e10s fission stylo webrender', ' rev: spam', ' - Windows 10, -2.401 %, , 1.2, , 49.00 %', - ' - Linux 18.04, 1.849 %, Regression, 1.2, -, 44.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 1.3, -, 24.00 %', + ' - Linux 18.04, +1.849 %, Regression, 1.2, -, 44.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 1.3, -, 24.00 %', ' - Windows 10, -, , 1.2, , 99.00 %', ' rev: tictactoe', ' - Windows 10, -2.401 %, , 2, , 48.00 %', - ' - Linux 18.04, 1.849 %, Regression, 2, -, 43.00 %', - ' - macOS 10.15, 1.078 %, Improvement, 2.1, -, 23.00 %', + ' - Linux 18.04, +1.849 %, Regression, 2, -, 43.00 %', + ' - macOS 10.15, +1.078 %, Improvement, 2.1, -, 23.00 %', ' - Windows 10, -, , 2, , 98.00 %', ]); expect(effectSizeButton).toMatchSnapshot(); diff --git a/src/__tests__/CompareResults/SubtestsResultsView.test.tsx b/src/__tests__/CompareResults/SubtestsResultsView.test.tsx index bff3fb298..42c1a57c6 100644 --- a/src/__tests__/CompareResults/SubtestsResultsView.test.tsx +++ b/src/__tests__/CompareResults/SubtestsResultsView.test.tsx @@ -258,10 +258,10 @@ describe('SubtestsResultsView Component Tests', () => { // Initial view (alphabetical ordered, even if "sort by subtests" isn't specified expect(summarizeVisibleRows()).toEqual([ 'browser.html: -1.43 %, Low', - 'dhtml.html: 1.14 %, Low', + 'dhtml.html: +1.14 %, Low', 'improvement.html: -1.44 %, Low', - 'regression.html: 1.04 %, High', - 'tablemutation.html: 0.98 %, Low', + 'regression.html: +1.04 %, High', + 'tablemutation.html: +0.98 %, Low', ]); // Sort by Delta @@ -274,9 +274,9 @@ describe('SubtestsResultsView Component Tests', () => { expect(summarizeVisibleRows()).toEqual([ 'improvement.html: -1.44 %, Low', 'browser.html: -1.43 %, Low', - 'dhtml.html: 1.14 %, Low', - 'regression.html: 1.04 %, High', - 'tablemutation.html: 0.98 %, Low', + 'dhtml.html: +1.14 %, Low', + 'regression.html: +1.04 %, High', + 'tablemutation.html: +0.98 %, Low', ]); // It should have the "descending" SVG. expect(deltaButton).toMatchSnapshot(); @@ -286,9 +286,9 @@ describe('SubtestsResultsView Component Tests', () => { // Sort ascending await user.click(deltaButton); expect(summarizeVisibleRows()).toEqual([ - 'tablemutation.html: 0.98 %, Low', - 'regression.html: 1.04 %, High', - 'dhtml.html: 1.14 %, Low', + 'tablemutation.html: +0.98 %, Low', + 'regression.html: +1.04 %, High', + 'dhtml.html: +1.14 %, Low', 'browser.html: -1.43 %, Low', 'improvement.html: -1.44 %, Low', ]); @@ -303,11 +303,11 @@ describe('SubtestsResultsView Component Tests', () => { }); await user.click(confidenceButton); expect(summarizeVisibleRows()).toEqual([ - 'regression.html: 1.04 %, High', + 'regression.html: +1.04 %, High', 'improvement.html: -1.44 %, Low', 'browser.html: -1.43 %, Low', - 'dhtml.html: 1.14 %, Low', - 'tablemutation.html: 0.98 %, Low', + 'dhtml.html: +1.14 %, Low', + 'tablemutation.html: +0.98 %, Low', ]); // It should have the "no sort" SVG. expect(deltaButton).toMatchSnapshot(); @@ -320,10 +320,10 @@ describe('SubtestsResultsView Component Tests', () => { const subtestsButton = screen.getByRole('button', { name: /Subtests/ }); await user.click(subtestsButton); expect(summarizeVisibleRows()).toEqual([ - 'tablemutation.html: 0.98 %, Low', - 'regression.html: 1.04 %, High', + 'tablemutation.html: +0.98 %, Low', + 'regression.html: +1.04 %, High', 'improvement.html: -1.44 %, Low', - 'dhtml.html: 1.14 %, Low', + 'dhtml.html: +1.14 %, Low', 'browser.html: -1.43 %, Low', ]); // It should have the "no sort" SVG. @@ -343,9 +343,9 @@ describe('SubtestsResultsView Component Tests', () => { await setupForSorting({ extraParameters: 'sort=delta|asc' }); await screen.findByText('dhtml.html'); expect(summarizeVisibleRows()).toEqual([ - 'tablemutation.html: 0.98 %, Low', - 'regression.html: 1.04 %, High', - 'dhtml.html: 1.14 %, Low', + 'tablemutation.html: +0.98 %, Low', + 'regression.html: +1.04 %, High', + 'dhtml.html: +1.14 %, Low', 'browser.html: -1.43 %, Low', 'improvement.html: -1.44 %, Low', ]); @@ -359,9 +359,9 @@ describe('SubtestsResultsView Component Tests', () => { expect(summarizeVisibleRows()).toEqual([ 'improvement.html: -1.44 %, Low', 'browser.html: -1.43 %, Low', - 'dhtml.html: 1.14 %, Low', - 'regression.html: 1.04 %, High', - 'tablemutation.html: 0.98 %, Low', + 'dhtml.html: +1.14 %, Low', + 'regression.html: +1.04 %, High', + 'tablemutation.html: +0.98 %, Low', ]); // It should have the "descending" SVG. expect(screen.getByRole('button', { name: /Delta/ })).toMatchSnapshot(); @@ -372,9 +372,9 @@ describe('SubtestsResultsView Component Tests', () => { expect(summarizeVisibleRows()).toEqual([ 'improvement.html: -1.44 %, Low', 'browser.html: -1.43 %, Low', - 'dhtml.html: 1.14 %, Low', - 'regression.html: 1.04 %, High', - 'tablemutation.html: 0.98 %, Low', + 'dhtml.html: +1.14 %, Low', + 'regression.html: +1.04 %, High', + 'tablemutation.html: +0.98 %, Low', ]); // It should have the "descending" SVG. expect(screen.getByRole('button', { name: /Delta/ })).toMatchSnapshot(); @@ -525,11 +525,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( await setupForSorting(); // Initial view (alphabetical ordered, even if "sort by subtests" isn't specified expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', ]); // Sort by Delta @@ -540,11 +540,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( // Sort descending await user.click(deltaButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', ]); // It should have the "descending" SVG. @@ -555,11 +555,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( // Sort ascending await user.click(deltaButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', ]); // It should have the "ascending" SVG. expect(deltaButton).toMatchSnapshot(); @@ -572,11 +572,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( }); await user.click(significanceButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', ]); // It should have the "no sort" SVG. expect(deltaButton).toMatchSnapshot(); @@ -588,11 +588,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( // Sort by Significance ascending await user.click(significanceButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', ]); expectParameterToHaveValue('sort', 'significance|asc'); @@ -602,11 +602,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( }); await user.click(effectButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', ]); // It should have the "descending" SVG. @@ -617,11 +617,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( // Sort by Effect Size ascending await user.click(effectButton); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', ]); expectParameterToHaveValue('sort', 'effects|asc'); }); @@ -630,11 +630,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( await setupForSorting({ extraParameters: 'sort=delta|asc' }); await screen.findByText('dhtml.html'); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'regression.html: 1.135 %, 0.12, , 25.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', ]); // It should have the "ascending" SVG. expect(screen.getByRole('button', { name: /CD/ })).toMatchSnapshot(); @@ -644,11 +644,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( await setupForSorting({ extraParameters: 'sort=delta' }); await screen.findByText('dhtml.html'); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', ]); // It should have the "descending" SVG. expect(screen.getByRole('button', { name: /CD/ })).toMatchSnapshot(); @@ -657,11 +657,11 @@ describe('SubtestsResultsView Component Tests for mann-whitney-u testVersion', ( it('initializes the sort from the URL at load time for a descending sort', async () => { await setupForSorting({ extraParameters: 'sort=delta|desc' }); expect(summarizeVisibleRows('mann-whitney-u')).toEqual([ - 'regression.html: 1.135 %, 0.12, , 25.00%', - 'improvement.html: 0.963 %, -0.05, , 50.00%', - 'browser.html: 0.963 %, -0.04, -, 15.00%', - 'dhtml.html: 1.135 %, 0.02, , 60.00%', - 'tablemutation.html: 0.98 %, 0.01, -, 45.00%', + 'regression.html: +1.135 %, 0.12, , 25.00%', + 'improvement.html: +0.963 %, -0.05, , 50.00%', + 'browser.html: +0.963 %, -0.04, -, 15.00%', + 'dhtml.html: +1.135 %, 0.02, , 60.00%', + 'tablemutation.html: +0.98 %, 0.01, -, 45.00%', ]); // It should have the "descending" SVG. expect(screen.getByRole('button', { name: /CD/ })).toMatchSnapshot(); diff --git a/src/__tests__/CompareResults/SubtestsRevisionRow.test.tsx b/src/__tests__/CompareResults/SubtestsRevisionRow.test.tsx index d8941e030..7f66a8707 100644 --- a/src/__tests__/CompareResults/SubtestsRevisionRow.test.tsx +++ b/src/__tests__/CompareResults/SubtestsRevisionRow.test.tsx @@ -40,7 +40,7 @@ describe('SubtestsRevisionRow Component', () => { await screen.findByText('dhtml.html'); expect(await screen.findByText('971.38 ms')).toBeInTheDocument(); expect(await screen.findByText('982.41 ms')).toBeInTheDocument(); - expect(await screen.findByText('1.14 %')).toBeInTheDocument(); + expect(await screen.findByText('+1.14 %')).toBeInTheDocument(); expect(await screen.findByText('Low')).toBeInTheDocument(); expect(document.body).toMatchSnapshot(); }); diff --git a/src/__tests__/CompareResults/__snapshots__/ResultsTable.test.tsx.snap b/src/__tests__/CompareResults/__snapshots__/ResultsTable.test.tsx.snap index 95f3f1fbf..464e4997b 100644 --- a/src/__tests__/CompareResults/__snapshots__/ResultsTable.test.tsx.snap +++ b/src/__tests__/CompareResults/__snapshots__/ResultsTable.test.tsx.snap @@ -4653,7 +4653,7 @@ exports[`Results Table for MannWhitneyResultsItem for mann-whitney-u testVersion - 1.849 % + +1.849 %
- 1.078 % + +1.078 %
- 1.078 % + +1.078 %
- 1.078 % + +1.078 %
- 1.08 % + +1.08 %
- 1.08 % + +1.08 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.98 % + +0.98 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.98 % + +0.98 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.963 % + +0.963 %
- 1.135 % + +1.135 %
- 0.98 % + +0.98 %
- 1.14 % + +1.14 %
- 1.14 % + +1.14 %
- {`${formatNumber(pct)} %`} + {`${signPrefix(pct)}${formatNumber(pct)} %`} {normality === 'one' && ( - {`${formatNumber(medianDiffPct)} %`} + {`${signPrefix(medianDiffPct)}${formatNumber(medianDiffPct)} %`} {normality === 'one' && (
{' '} - {`${deltaPercent} % `} + {`${signPrefix(deltaPercent)}${deltaPercent} % `}
{confidenceText && confidenceIcons[confidenceText]} @@ -260,22 +260,26 @@ export const studentTStrategy = { baseMedian && newMedian ? formatTwoDigits.format(newMedian - baseMedian) : ''; - const medianPercentage = + const medianPercentageNum = baseMedian && newMedian - ? formatTwoDigits.format(((newMedian - baseMedian) / baseMedian) * 100) - : ''; + ? ((newMedian - baseMedian) / baseMedian) * 100 + : 0; + const medianPercentage = + baseMedian && newMedian ? formatTwoDigits.format(medianPercentageNum) : ''; const { confidenceNote } = Strings.components.expandableRow; return ( <> - Difference of means: {deltaPercent}% ({formatNumber(delta)} + Difference of means: {signPrefix(deltaPercent)} + {deltaPercent}% ({formatNumber(delta)} {deltaUnit ? ' ' + deltaUnit : null}) {newMedian && baseMedian ? ( - Difference of medians: {medianPercentage}% ( + Difference of medians: {signPrefix(medianPercentageNum)} + {medianPercentage}% ( {medianDifference} {deltaUnit ? ' ' + deltaUnit : null}) @@ -334,7 +338,7 @@ export const studentTStrategy = { {determineStatus(!!improvement, !!regression)}
-
{` ${deltaPercent} % `}
+
{` ${signPrefix(deltaPercent)}${deltaPercent} % `}
{confidenceText && confidenceIcons[confidenceText]} {confidenceText || '-'} From 9fb776ea1d77a4f7e884b5a2f97bc2e9ab4cf5ea Mon Sep 17 00:00:00 2001 From: sumairq Date: Sun, 26 Jul 2026 08:16:55 +0500 Subject: [PATCH 3/8] Group thousands in Mann-Whitney metric values --- .../MannWhitneyCompareMetrics.tsx | 29 +++++++++++-------- src/components/CompareResults/RunValues.tsx | 4 +-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx index 1cead497e..69c9d9d33 100644 --- a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx +++ b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx @@ -1,10 +1,15 @@ import { Box } from '@mui/material'; import { MannWhitneyResultsItem } from '../../types/state'; +import { formatNumberFixedTwo } from '../../utils/format'; import { getModeInterpretation } from '../../utils/helpers'; const METRIC_HEADERS = ['Metric', 'Base', 'New', 'Interpretation']; +// Group thousand-scale measurement values while keeping the 2-decimal display. +const formatStat = (value: number | null | undefined) => + value != null ? formatNumberFixedTwo(value) : 'N/A'; + interface MannWhitneyCompareMetricsProps { result: MannWhitneyResultsItem; } @@ -98,38 +103,38 @@ export const MannWhitneyCompareMetrics = ({ Mean - {baseMean?.toFixed(2) ?? 'N/A'} - {newMean?.toFixed(2) ?? 'N/A'} + {formatStat(baseMean)} + {formatStat(newMean)} Median - {baseMedian?.toFixed(2) ?? 'N/A'} - {newMedian?.toFixed(2) ?? 'N/A'} + {formatStat(baseMedian)} + {formatStat(newMedian)} Variance - {baseVariance?.toFixed(2) ?? 'N/A'} - {newVariance?.toFixed(2) ?? 'N/A'} + {formatStat(baseVariance)} + {formatStat(newVariance)} Standard Deviation - {baseStandardDev?.toFixed(2) ?? 'N/A'} - {newStandardDev?.toFixed(2) ?? 'N/A'} + {formatStat(baseStandardDev)} + {formatStat(newStandardDev)} Min - {baseMin?.toFixed(2) ?? 'N/A'} - {newMin?.toFixed(2) ?? 'N/A'} + {formatStat(baseMin)} + {formatStat(newMin)} Max - {baseMax?.toFixed(2) ?? 'N/A'} - {newMax?.toFixed(2) ?? 'N/A'} + {formatStat(baseMax)} + {formatStat(newMax)} diff --git a/src/components/CompareResults/RunValues.tsx b/src/components/CompareResults/RunValues.tsx index 16825dd7e..076305bc3 100644 --- a/src/components/CompareResults/RunValues.tsx +++ b/src/components/CompareResults/RunValues.tsx @@ -63,7 +63,7 @@ function RunValues(props: RunValuesProps) { ))} {expanded ? lastValues.map((value, index) => ( -
{value}
+
{formatNumber(value)}
)) : null} {lastValues.length ? ( @@ -87,7 +87,7 @@ function RunValues(props: RunValuesProps) {
{values.length > 1 - ? `${stddev} ${unit} = ${stddevPercent}% standard deviation` + ? `${formatNumber(stddev)} ${unit} = ${stddevPercent}% standard deviation` : 'N/A standard deviation'}
From de7358f527746a7cb0cc9333690952d0d0a07456 Mon Sep 17 00:00:00 2001 From: sumairq Date: Sun, 26 Jul 2026 08:23:13 +0500 Subject: [PATCH 4/8] Make the comment for formatStat more accurate --- src/components/CompareResults/MannWhitneyCompareMetrics.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx index 69c9d9d33..71286c693 100644 --- a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx +++ b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx @@ -6,7 +6,7 @@ import { getModeInterpretation } from '../../utils/helpers'; const METRIC_HEADERS = ['Metric', 'Base', 'New', 'Interpretation']; -// Group thousand-scale measurement values while keeping the 2-decimal display. +// Format a stat with thousands grouping and 2 decimals, or "N/A" when the value is missing. const formatStat = (value: number | null | undefined) => value != null ? formatNumberFixedTwo(value) : 'N/A'; From eac60e81b458cfb4bf690f03696c2242cd20723a Mon Sep 17 00:00:00 2001 From: sumairq Date: Sun, 26 Jul 2026 08:33:46 +0500 Subject: [PATCH 5/8] Fix code format errors --- src/common/testVersions/studentT.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/testVersions/studentT.tsx b/src/common/testVersions/studentT.tsx index 26037e985..3dfbf7967 100644 --- a/src/common/testVersions/studentT.tsx +++ b/src/common/testVersions/studentT.tsx @@ -265,7 +265,9 @@ export const studentTStrategy = { ? ((newMedian - baseMedian) / baseMedian) * 100 : 0; const medianPercentage = - baseMedian && newMedian ? formatTwoDigits.format(medianPercentageNum) : ''; + baseMedian && newMedian + ? formatTwoDigits.format(medianPercentageNum) + : ''; const { confidenceNote } = Strings.components.expandableRow; @@ -279,8 +281,7 @@ export const studentTStrategy = { {newMedian && baseMedian ? ( Difference of medians: {signPrefix(medianPercentageNum)} - {medianPercentage}% ( - {medianDifference} + {medianPercentage}% ({medianDifference} {deltaUnit ? ' ' + deltaUnit : null}) ) : null} @@ -338,7 +339,10 @@ export const studentTStrategy = { {determineStatus(!!improvement, !!regression)}
-
{` ${signPrefix(deltaPercent)}${deltaPercent} % `}
+
{` ${signPrefix(deltaPercent)}${deltaPercent} % `}
{confidenceText && confidenceIcons[confidenceText]} {confidenceText || '-'} From c6bec8f97aee8b7058465f1c8b6380c4e3954299 Mon Sep 17 00:00:00 2001 From: sumairq Date: Tue, 18 Aug 2026 12:50:39 +0500 Subject: [PATCH 6/8] Refactor signPrefix into a unified withSign helper and fix +0/-0 display --- src/common/testVersions/mannWhitney.tsx | 6 +++--- src/common/testVersions/studentT.tsx | 20 ++++++++------------ src/utils/format.ts | 14 ++++++++++++-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/common/testVersions/mannWhitney.tsx b/src/common/testVersions/mannWhitney.tsx index 974e1cbe3..759aff02e 100644 --- a/src/common/testVersions/mannWhitney.tsx +++ b/src/common/testVersions/mannWhitney.tsx @@ -15,7 +15,7 @@ import { } from '../../types/state'; import { TableConfig } from '../../types/types'; import { bootstrapMedianDiffCI } from '../../utils/bootstrap-ci'; -import { adaptUnit, formatNumber, signPrefix } from '../../utils/format'; +import { adaptUnit, formatNumber, withSign } from '../../utils/format'; import { capitalize } from '../../utils/helpers'; import { getBrowserDisplay, getPlatformShortName } from '../../utils/platform'; import { @@ -314,7 +314,7 @@ export const mannWhitneyStrategy = { gap: '4px', }} > - {`${signPrefix(pct)}${formatNumber(pct)} %`} + {`${withSign(formatNumber(pct))} %`} {normality === 'one' && ( - {`${signPrefix(medianDiffPct)}${formatNumber(medianDiffPct)} %`} + {`${withSign(formatNumber(medianDiffPct))} %`} {normality === 'one' && (
{' '} - {`${signPrefix(deltaPercent)}${deltaPercent} % `} + {`${withSign(deltaPercent)} % `}
{confidenceText && confidenceIcons[confidenceText]} @@ -260,13 +260,9 @@ export const studentTStrategy = { baseMedian && newMedian ? formatTwoDigits.format(newMedian - baseMedian) : ''; - const medianPercentageNum = - baseMedian && newMedian - ? ((newMedian - baseMedian) / baseMedian) * 100 - : 0; const medianPercentage = baseMedian && newMedian - ? formatTwoDigits.format(medianPercentageNum) + ? formatTwoDigits.format(((newMedian - baseMedian) / baseMedian) * 100) : ''; const { confidenceNote } = Strings.components.expandableRow; @@ -274,14 +270,14 @@ export const studentTStrategy = { return ( <> - Difference of means: {signPrefix(deltaPercent)} - {deltaPercent}% ({formatNumber(delta)} + Difference of means: {withSign(deltaPercent)}% ( + {formatNumber(delta)} {deltaUnit ? ' ' + deltaUnit : null}) {newMedian && baseMedian ? ( - Difference of medians: {signPrefix(medianPercentageNum)} - {medianPercentage}% ({medianDifference} + Difference of medians: {withSign(medianPercentage)}% ( + {medianDifference} {deltaUnit ? ' ' + deltaUnit : null}) ) : null} @@ -342,7 +338,7 @@ export const studentTStrategy = {
{` ${signPrefix(deltaPercent)}${deltaPercent} % `}
+ >{` ${withSign(deltaPercent)} % `}
{confidenceText && confidenceIcons[confidenceText]} {confidenceText || '-'} diff --git a/src/utils/format.ts b/src/utils/format.ts index b9d588af3..a0e799088 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -22,8 +22,18 @@ export const formatNumber = (value: number) => { return numberFormatter.format(value); }; -// Returns a leading "+" for positive values only (negatives already carry "-"). -export const signPrefix = (value: number) => (value > 0 ? '+' : ''); +// Returns the value as a string with a leading "+" when it is positive; negatives +// already carry "-", zero gets no sign. A negative that rounds to zero ("-0", +// "-0.00") is really zero, so its stray minus is dropped. Accepts a raw number or an +// already-formatted string, so the sign is decided from the exact text displayed. +export const withSign = (value: number | string) => { + const numeric = typeof value === 'number' ? value : parseFloat(value); + if (numeric > 0) return `+${value}`; + if (numeric === 0 && typeof value === 'string' && value.startsWith('-')) { + return value.slice(1); + } + return `${value}`; +}; export const formatNumberFixedTwo = (value: number) => { return numberFormatterFixedTwo.format(value); From 93569973a738762ba993d94f604bf4dec285f56a Mon Sep 17 00:00:00 2001 From: sumairq Date: Tue, 18 Aug 2026 12:51:14 +0500 Subject: [PATCH 7/8] Add unit tests for withSign helper --- src/__tests__/format.test.ts | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/__tests__/format.test.ts diff --git a/src/__tests__/format.test.ts b/src/__tests__/format.test.ts new file mode 100644 index 000000000..0f7ea3666 --- /dev/null +++ b/src/__tests__/format.test.ts @@ -0,0 +1,52 @@ +import { formatNumber, formatNumberFixedTwo, withSign } from '../utils/format'; + +describe('withSign', () => { + describe('with raw numbers', () => { + it('prefixes a positive number with "+"', () => { + expect(withSign(1.08)).toBe('+1.08'); + }); + + it('leaves a negative number with its own "-"', () => { + expect(withSign(-1.08)).toBe('-1.08'); + }); + + it('gives zero no sign', () => { + expect(withSign(0)).toBe('0'); + }); + + it('collapses negative zero to a plain zero', () => { + expect(withSign(-0)).toBe('0'); + }); + }); + + describe('with formatted strings (the display path)', () => { + it('does not add "+" to a positive that rounds to zero', () => { + expect(withSign(formatNumber(0.0004))).toBe('0'); // not '+0' + }); + + it('drops the stray "-" from a negative that rounds to zero', () => { + expect(withSign(formatNumber(-0.0004))).toBe('0'); // not '-0' + }); + + it('prefixes a positive formatted value with "+"', () => { + expect(withSign(formatNumber(1.08))).toBe('+1.08'); + }); + + it('keeps the "-" on a negative formatted value', () => { + expect(withSign(formatNumber(-1.08))).toBe('-1.08'); + }); + + it('preserves thousands grouping while adding the sign', () => { + expect(withSign(formatNumber(2113.69))).toBe('+2,113.69'); + expect(withSign(formatNumber(-2113.69))).toBe('-2,113.69'); + }); + + it('drops the stray "-" from a fixed-two-decimal negative zero', () => { + expect(withSign(formatNumberFixedTwo(-0.0004))).toBe('0.00'); // not '-0.00' + }); + + it('returns an empty string unchanged (the "no runs" guard case)', () => { + expect(withSign('')).toBe(''); + }); + }); +}); From 67df7822399e52d9a340ed9831e6da7b6c68c614 Mon Sep 17 00:00:00 2001 From: sumairq Date: Tue, 18 Aug 2026 13:56:57 +0500 Subject: [PATCH 8/8] Fix lint error --- src/components/CompareResults/MannWhitneyCompareMetrics.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx index 1aa248057..76817cf34 100644 --- a/src/components/CompareResults/MannWhitneyCompareMetrics.tsx +++ b/src/components/CompareResults/MannWhitneyCompareMetrics.tsx @@ -2,7 +2,6 @@ import { Box } from '@mui/material'; import { MannWhitneyResultsItem } from '../../types/state'; import { formatNumberFixedTwo } from '../../utils/format'; -import { getModeInterpretation } from '../../utils/helpers'; const METRIC_HEADERS = ['Metric', 'Base', 'New', 'Interpretation'];