From 474a30e355dedddb6c3510a3718a64d111314c34 Mon Sep 17 00:00:00 2001 From: Zoe Steinkamp Date: Tue, 26 May 2020 22:09:25 -0600 Subject: [PATCH] Fix: Bin size limit limit bin size to 670, which craches on my computer beyong this And added test to confirm its working --- ui/cypress/e2e/explorer.test.ts | 12 ++++++++++++ .../components/view_options/HeatmapOptions.tsx | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/cypress/e2e/explorer.test.ts b/ui/cypress/e2e/explorer.test.ts index 53e2001108..1518efe307 100644 --- a/ui/cypress/e2e/explorer.test.ts +++ b/ui/cypress/e2e/explorer.test.ts @@ -129,6 +129,18 @@ describe('DataExplorer', () => { }) }) }) + + it('should error when value is above "670" in bin size', () => { + cy.get('.view-options').within(() => { + cy.getByTestID('grid--column').within(() => { + cy.getByTestID('bin-size-input') + .clear() + .type('670') + .getByTestID('bin-size-input--error') + .should('have.length', 1) + }) + }) + }) }) describe('numeric input validation when changing number of decimal places in Single Stat', () => { diff --git a/ui/src/timeMachine/components/view_options/HeatmapOptions.tsx b/ui/src/timeMachine/components/view_options/HeatmapOptions.tsx index 396b1f5846..c216dfdb9e 100644 --- a/ui/src/timeMachine/components/view_options/HeatmapOptions.tsx +++ b/ui/src/timeMachine/components/view_options/HeatmapOptions.tsx @@ -97,7 +97,7 @@ const HeatmapOptions: FunctionComponent = props => { const val = convertUserInputToNumOrNaN(e) setBinInput(val) - if (isNaN(val) || val < 5) { + if (isNaN(val) || val < 5 || val > 670) { setBinInputStatus(ComponentStatus.Error) return } @@ -142,6 +142,7 @@ const HeatmapOptions: FunctionComponent = props => { value={binInput} type={InputType.Number} onChange={onSetBinSize} + testID={'bin-size-input'} />
X Axis