From 8867402d249b176598d64a78efbe23e064ca2b2f Mon Sep 17 00:00:00 2001 From: john-rodriguez-adhocteam <146031450+john-rodriguez-adhocteam@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:16:17 -0400 Subject: [PATCH] [VA-IIR 755] fix VA Alert on search form not closing (#30341) --- .../yellow-ribbon/actions/index.unit.spec.js | 19 +++++++++++++++ .../containers/SearchResults/index.jsx | 23 +++++++++++-------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/applications/yellow-ribbon/actions/index.unit.spec.js b/src/applications/yellow-ribbon/actions/index.unit.spec.js index 7b44faab9509..ca25b04f20e6 100644 --- a/src/applications/yellow-ribbon/actions/index.unit.spec.js +++ b/src/applications/yellow-ribbon/actions/index.unit.spec.js @@ -2,6 +2,7 @@ import { expect } from 'chai'; import sinon from 'sinon'; // Relative imports. +import { apiRequest } from 'platform/utilities/api'; import { fetchResultsAction, fetchResultsFailure, @@ -60,6 +61,8 @@ describe('Yellow Ribbon actions', () => { describe('fetchResultsThunk', () => { let mockedLocation; let mockedHistory; + let updateQueryParamsStub; + let apiRequestStub; beforeEach(() => { mockedLocation = { @@ -70,6 +73,22 @@ describe('Yellow Ribbon actions', () => { mockedHistory = { replaceState: sinon.stub(), }; + + const queryParams = new URLSearchParams(mockedLocation.search); + + apiRequestStub = sinon.stub(apiRequest, 'default').resolves({ + data: { + results: [], + totalResults: 0, + }, + }); + + updateQueryParamsStub = sinon.stub(queryParams, 'updateQuery').returns(); + }); + + afterEach(() => { + apiRequestStub.restore(); + updateQueryParamsStub.restore(); }); it('updates search params', async () => { diff --git a/src/applications/yellow-ribbon/containers/SearchResults/index.jsx b/src/applications/yellow-ribbon/containers/SearchResults/index.jsx index 53198337c974..e74bdb279ff3 100644 --- a/src/applications/yellow-ribbon/containers/SearchResults/index.jsx +++ b/src/applications/yellow-ribbon/containers/SearchResults/index.jsx @@ -2,7 +2,10 @@ /* eslint-disable react/static-property-placement */ // Dependencies. import React, { Component } from 'react'; -import { VaPagination } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; +import { + VaAlert, + VaPagination, +} from '@department-of-veterans-affairs/component-library/dist/react-bindings'; import PropTypes from 'prop-types'; import recordEvent from 'platform/monitoring/record-event'; import { connect } from 'react-redux'; @@ -236,10 +239,10 @@ export class SearchResults extends Component { // Show the error alert box if there was an error. if (error) { return ( - +

Something went wrong

{error}
-
+ ); } @@ -258,8 +261,9 @@ export class SearchResults extends Component { > No schools found for your search criteria. - {TOOL_TIP_CONTENT} - + ); } @@ -296,8 +300,9 @@ export class SearchResults extends Component { - {TOOL_TIP_CONTENT} - + {/* Table of Results */}