From 0528bb232e6cbcbbe976bb4ce675f90920b652b1 Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Date: Thu, 16 Nov 2023 12:43:10 -0800 Subject: [PATCH] Fix failing tests --- .../project/add/AddProjectForm.test.tsx | 20 +- .../AddProjectContainer.test.tsx.snap | 173 +++++--- .../AddProjectForm.test.tsx.snap | 406 ++++++++++++------ 3 files changed, 401 insertions(+), 198 deletions(-) diff --git a/source/frontend/src/features/mapSideBar/project/add/AddProjectForm.test.tsx b/source/frontend/src/features/mapSideBar/project/add/AddProjectForm.test.tsx index 72a9b733c9..308640fecf 100644 --- a/source/frontend/src/features/mapSideBar/project/add/AddProjectForm.test.tsx +++ b/source/frontend/src/features/mapSideBar/project/add/AddProjectForm.test.tsx @@ -88,11 +88,13 @@ describe('AddProjectForm component', () => { getProductCodeTextBox: (index: number) => utils.container.querySelector(`input[name="products.${index}.code"]`) as HTMLInputElement, getCostTypeDropdown: () => - utils.container.querySelector(`select[name="costTypeCode"]`) as HTMLSelectElement, + utils.container.querySelector(`[name="typeahead-select-costTypeCode"]`) as HTMLElement, getWorkActivityDropdown: () => - utils.container.querySelector(`select[name="workActivityCode"]`) as HTMLSelectElement, + utils.container.querySelector(`[name="typeahead-select-workActivityCode"]`) as HTMLElement, getBusinessFunctionDropdown: () => - utils.container.querySelector(`select[name="businessFunctionCode"]`) as HTMLSelectElement, + utils.container.querySelector( + `[name="typeahead-select-businessFunctionCode"]`, + ) as HTMLElement, }; }; @@ -131,7 +133,7 @@ describe('AddProjectForm component', () => { const input = getNameTextbox(); const number = getNumberTextbox(); - const select = getRegionDropdown(); + const region = getRegionDropdown(); const status = getStatusDropdown(); const summary = getSummaryTextbox(); const costType = getCostTypeDropdown(); @@ -139,7 +141,7 @@ describe('AddProjectForm component', () => { const businessFunction = getBusinessFunctionDropdown(); expect(input).toBeVisible(); - expect(select).toBeVisible(); + expect(region).toBeVisible(); expect(number).toBeVisible(); expect(status).toBeVisible(); expect(summary).toBeVisible(); @@ -147,12 +149,12 @@ describe('AddProjectForm component', () => { expect(input.tagName).toBe('INPUT'); expect(number.tagName).toBe('INPUT'); expect(summary.tagName).toBe('TEXTAREA'); - expect(select.tagName).toBe('SELECT'); + expect(region.tagName).toBe('SELECT'); expect(status.tagName).toBe('SELECT'); - expect(costType.tagName).toBe('SELECT'); - expect(workActivity.tagName).toBe('SELECT'); - expect(businessFunction.tagName).toBe('SELECT'); + expect(costType.tagName).toBe('INPUT'); + expect(workActivity.tagName).toBe('INPUT'); + expect(businessFunction.tagName).toBe('INPUT'); }); it('should validate character limits', async () => { diff --git a/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap b/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap index ef8a1f86b6..e9312ce892 100644 --- a/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap +++ b/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap @@ -80,7 +80,7 @@ exports[`AddProjectContainer component renders as expected 1`] = ` class="c2" /> - .c9.btn { + .c10.btn { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -110,49 +110,49 @@ exports[`AddProjectContainer component renders as expected 1`] = ` cursor: pointer; } -.c9.btn:hover { +.c10.btn:hover { -webkit-text-decoration: underline; text-decoration: underline; opacity: 0.8; } -.c9.btn:focus { +.c10.btn:focus { outline-width: 0.4rem; outline-style: solid; outline-offset: 1px; box-shadow: none; } -.c9.btn.btn-primary { +.c10.btn.btn-primary { border: none; } -.c9.btn.btn-secondary { +.c10.btn.btn-secondary { background: none; } -.c9.btn.btn-info { +.c10.btn.btn-info { border: none; background: none; padding-left: 0.6rem; padding-right: 0.6rem; } -.c9.btn.btn-info:hover, -.c9.btn.btn-info:active, -.c9.btn.btn-info:focus { +.c10.btn.btn-info:hover, +.c10.btn.btn-info:active, +.c10.btn.btn-info:focus { background: none; } -.c9.btn.btn-light { +.c10.btn.btn-light { border: none; } -.c9.btn.btn-dark { +.c10.btn.btn-dark { border: none; } -.c9.btn.btn-link { +.c10.btn.btn-link { font-size: 1.6rem; font-weight: 400; background: none; @@ -173,9 +173,9 @@ exports[`AddProjectContainer component renders as expected 1`] = ` padding: 0; } -.c9.btn.btn-link:hover, -.c9.btn.btn-link:active, -.c9.btn.btn-link:focus { +.c10.btn.btn-link:hover, +.c10.btn.btn-link:active, +.c10.btn.btn-link:focus { -webkit-text-decoration: underline; text-decoration: underline; border: none; @@ -184,14 +184,14 @@ exports[`AddProjectContainer component renders as expected 1`] = ` outline: none; } -.c9.btn.btn-link:disabled, -.c9.btn.btn-link.disabled { +.c10.btn.btn-link:disabled, +.c10.btn.btn-link.disabled { background: none; pointer-events: none; } -.c9.btn:disabled, -.c9.btn:disabled:hover { +.c10.btn:disabled, +.c10.btn:disabled:hover { box-shadow: none; -webkit-user-select: none; -moz-user-select: none; @@ -202,15 +202,15 @@ exports[`AddProjectContainer component renders as expected 1`] = ` opacity: 0.65; } -.c9.Button .Button__icon { +.c10.Button .Button__icon { margin-right: 1.6rem; } -.c9.Button--icon-only:focus { +.c10.Button--icon-only:focus { outline: none; } -.c9.Button--icon-only .Button__icon { +.c10.Button--icon-only .Button__icon { margin-right: 0; } @@ -228,6 +228,10 @@ exports[`AddProjectContainer component renders as expected 1`] = ` width: 100%; } +.c9 button.close { + font-size: 2.4rem; +} + .c4 { font-weight: bold; border-bottom: 0.2rem solid; @@ -561,19 +565,40 @@ exports[`AddProjectContainer component renders as expected 1`] = ` class="c7 text-left col" >
- + + +
+ @@ -593,19 +618,40 @@ exports[`AddProjectContainer component renders as expected 1`] = ` class="c7 text-left col" >
- + + +
+ @@ -625,19 +671,40 @@ exports[`AddProjectContainer component renders as expected 1`] = ` class="c7 text-left col" >
- + + +
+ @@ -663,7 +730,7 @@ exports[`AddProjectContainer component renders as expected 1`] = ` class="collapse show" >