From ecbcbd8b4b69312152ef764a60557873d869d48b Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Fri, 31 Jan 2025 12:18:21 +0000 Subject: [PATCH] setting section thinckness inputs only for sectionned slots --- cypress/e2e/pages/sectioningPlanning.cy.ts | 15 ++++- src/components/planning/LabwarePlan.tsx | 68 +++++++++++----------- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/cypress/e2e/pages/sectioningPlanning.cy.ts b/cypress/e2e/pages/sectioningPlanning.cy.ts index bab98c31..1dc1ba61 100644 --- a/cypress/e2e/pages/sectioningPlanning.cy.ts +++ b/cypress/e2e/pages/sectioningPlanning.cy.ts @@ -103,6 +103,13 @@ describe('Sectioning Planning', () => { cy.findByRole('button', { name: /Next/i }).should('be.disabled'); }); + it('section thickness inputs initially are empty and disabled', () => { + cy.findAllByTestId('section-thickness').each((input) => { + cy.wrap(input).should('have.value', ''); + cy.wrap(input).should('be.disabled'); + }); + }); + context('when I try and leave the page', () => { it('shows a confirm box', () => { cy.on('window:confirm', (str) => { @@ -126,7 +133,6 @@ describe('Sectioning Planning', () => { cy.findByText('A1').click(); cy.findByText('Done').click(); }); - cy.findByTestId('section-thickness-A1').type('5'); }); after(() => { @@ -136,6 +142,11 @@ describe('Sectioning Planning', () => { it('enables the Create Labware button', () => { cy.findByText('Create Labware').should('not.be.disabled'); }); + + it('enables and set section thickness input to the predefined value', () => { + cy.findAllByTestId('section-thickness').eq(0).should('have.value', '0.5'); + cy.findAllByTestId('section-thickness').eq(0).should('be.enabled'); + }); }); }); @@ -266,7 +277,7 @@ function createLabware() { cy.findByText('A1').click(); cy.findByText('Done').click(); }); - cy.findByTestId('section-thickness-A1').clear().type('5'); + cy.findByTestId('section-thickness').eq(0).clear().type('5'); cy.findByText('Create Labware').click(); } diff --git a/src/components/planning/LabwarePlan.tsx b/src/components/planning/LabwarePlan.tsx index 1589e371..8ed46d5f 100644 --- a/src/components/planning/LabwarePlan.tsx +++ b/src/components/planning/LabwarePlan.tsx @@ -33,7 +33,6 @@ import ScanInput from '../scanInput/ScanInput'; import FormikSelect from '../forms/Select'; import { objectKeys, Position } from '../../lib/helpers'; import { FormikErrorMessage } from '../forms'; -import Table, { TableBody, TableHead, TableHeader } from '../Table'; type LabwarePlanProps = { /** @@ -223,39 +222,42 @@ const LabwarePlan = React.forwardRef( )} {outputLabware.labwareType.name !== LabwareTypeName.FETAL_WASTE_CONTAINER && ( - - - - Slot - Section Thickness - - - - {outputLabware.slots.map((slot, index) => ( - - - - +
+
+
Section Thickness
+
+
+ {outputLabware.slots.map((slot) => ( +
+ {slot.address} + { + setHighlightedSlots(new Set([slot.address])); + }} + onBlur={() => { + setHighlightedSlots(new Set()); + }} + /> +
))} - -
{slot.address} - { - setHighlightedSlots(new Set([slot.address])); - }} - onBlur={() => { - setHighlightedSlots(new Set()); - }} - /> -
+ + )}