Skip to content

Commit c69f165

Browse files
committed
Merge branch 'TTAHUB-105/al-increase-unit-test-coverage' of https://github.com/adhocteam/Head-Start-TTADP into TTAHUB-105/al-increase-unit-test-coverage
2 parents dd53490 + 2dcbd32 commit c69f165

26 files changed

+529
-167
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ parameters:
164164
default: "main"
165165
type: string
166166
sandbox_git_branch: # change to feature branch to test deployment
167-
default: "add-wysisyg-editor"
167+
default: "kw-fix-piv-card-login"
168168
type: string
169169
prod_new_relic_app_id:
170170
default: "877570491"

deployment_config/dev_vars.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ web_memory: 512M
44
worker_instances: 1
55
worker_memory: 512M
66
LOG_LEVEL: info
7-
AUTH_BASE: https://uat.hsesinfo.org
7+
AUTH_BASE: https://staging.hses.ohs.acf.hhs.gov
88
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
99
REDIRECT_URI_HOST: https://tta-smarthub-dev.app.cloud.gov
1010
TTA_SMART_HUB_URI: https://tta-smarthub-dev.app.cloud.gov

deployment_config/prod_vars.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
env: prod
2-
web_instances: 2
3-
web_memory: 512M
2+
web_instances: 3
3+
web_memory: 2GB
44
worker_instances: 1
55
worker_memory: 512M
6-
LOG_LEVEL: debug
6+
LOG_LEVEL: info
77
AUTH_BASE: https://hses.ohs.acf.hhs.gov
88
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
99
REDIRECT_URI_HOST: https://ttahub.ohs.acf.hhs.gov

deployment_config/sandbox_vars.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ web_memory: 512M
44
worker_instances: 1
55
worker_memory: 512M
66
LOG_LEVEL: info
7-
AUTH_BASE: https://uat.hsesinfo.org
7+
AUTH_BASE: https://staging.hses.ohs.acf.hhs.gov
88
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
99
REDIRECT_URI_HOST: https://tta-smarthub-sandbox.app.cloud.gov
1010
TTA_SMART_HUB_URI: https://tta-smarthub-sandbox.app.cloud.gov

deployment_config/staging_vars.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ web_memory: 512M
44
worker_instances: 1
55
worker_memory: 512M
66
LOG_LEVEL: info
7-
AUTH_BASE: https://uat.hsesinfo.org
7+
AUTH_BASE: https://staging.hses.ohs.acf.hhs.gov
88
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
99
REDIRECT_URI_HOST: https://tta-smarthub-staging.app.cloud.gov
1010
TTA_SMART_HUB_URI: https://tta-smarthub-staging.app.cloud.gov

frontend/src/components/AriaLiveRegion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function AriaLiveRegion(props) {
55
const { messages } = props;
66

77
return (
8-
<div className="sr-only" role="status">
8+
<div className="usa-sr-only" role="status">
99
{ // messages are not unique and don't have unique key
1010
// eslint-disable-next-line react/no-array-index-key
1111
messages.map((m, index) => (<p key={index}>{m}</p>))

frontend/src/components/DatePicker.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,25 @@ import './DatePicker.css';
2222
const dateFmt = 'MM/DD/YYYY';
2323

2424
const DateInput = ({
25-
control, minDate, name, disabled, maxDate, openUp, required, ariaName,
25+
control, minDate, name, disabled, maxDate, openUp, required, ariaName, maxDateInclusive,
2626
}) => {
2727
const hintId = `${name}-hint`;
2828
const [isFocused, updateFocus] = useState(false);
2929
const openDirection = openUp ? OPEN_UP : OPEN_DOWN;
3030

3131
const isOutsideRange = (date) => {
3232
const isBefore = minDate && date.isBefore(moment(minDate, dateFmt));
33-
const isAfter = maxDate && date.isAfter(moment(maxDate, dateFmt));
33+
34+
// If max date is inclusive (maxDateInclusive == true)
35+
// allow the user to pick a start date that is the same as the maxDate
36+
// otherwise, only the day before is allowed
37+
let isAfter = false;
38+
if (maxDateInclusive) {
39+
const newDate = moment(maxDate, dateFmt).add(1, 'days');
40+
isAfter = maxDate && date.isAfter(newDate, dateFmt);
41+
} else {
42+
isAfter = maxDate && date.isAfter(moment(maxDate, dateFmt));
43+
}
3444

3545
return isBefore || isAfter;
3646
};
@@ -103,6 +113,7 @@ DateInput.propTypes = {
103113
openUp: PropTypes.bool,
104114
disabled: PropTypes.bool,
105115
required: PropTypes.bool,
116+
maxDateInclusive: PropTypes.bool,
106117
};
107118

108119
DateInput.defaultProps = {
@@ -111,6 +122,7 @@ DateInput.defaultProps = {
111122
disabled: false,
112123
openUp: false,
113124
required: true,
125+
maxDateInclusive: false,
114126
};
115127

116128
export default DateInput;

frontend/src/components/__tests__/DatePicker.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import {
44
render, screen, fireEvent, waitFor,
55
} from '@testing-library/react';
6-
76
import { useForm } from 'react-hook-form/dist/index.ie11';
87
import DatePicker from '../DatePicker';
98

frontend/src/pages/ActivityReport/Pages/activitySummary.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import PropTypes from 'prop-types';
33
import { Helmet } from 'react-helmet';
44
import { useFormContext } from 'react-hook-form/dist/index.ie11';
55
import { isEmpty } from 'lodash';
6-
76
import {
87
Fieldset, Radio, Grid, TextInput, Checkbox,
98
} from '@trussworks/react-uswds';
10-
119
import ReviewPage from './Review/ReviewPage';
1210
import DatePicker from '../../../components/DatePicker';
1311
import MultiSelect from '../../../components/MultiSelect';
@@ -243,6 +241,7 @@ const ActivitySummary = ({
243241
ariaName="Start Date (Required)"
244242
control={control}
245243
maxDate={endDate}
244+
maxDateInclusive
246245
name="startDate"
247246
openUp
248247
/>

frontend/src/pages/ActivityReport/__tests__/index.js

+30
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,35 @@ describe('ActivityReport', () => {
212212
granteeSelectbox = await screen.findByLabelText(/grantee name\(s\)/i);
213213
expect(within(granteeSelectbox).queryByText('Grantee Name')).toBeNull();
214214
});
215+
216+
it('allows you to pick the same start and end date', async () => {
217+
// render a new activity report
218+
renderActivityReport('new');
219+
220+
// we need to wait for the page to render, that's what this is for
221+
const dateSection = await screen.findByRole('group', { name: 'Activity date' });
222+
223+
// get the start date text box and type in a date
224+
const startDate = within(dateSection).getByRole('textbox', { name: /start date \(required\), month\/day\/year, edit text/i });
225+
userEvent.type(startDate, '12/25/1967');
226+
227+
// then type in a different date in the end date box
228+
const endDate = within(dateSection).getByRole('textbox', { name: /end date \(required\), month\/day\/year, edit text/i });
229+
userEvent.type(endDate, '12/26/1967');
230+
231+
// then change the start date to a date after the end date
232+
userEvent.clear(startDate);
233+
userEvent.type(startDate, '12/28/1967');
234+
235+
// expect an error
236+
expect(endDate).toBeDisabled();
237+
238+
// then change the start date to a date after the end date
239+
userEvent.clear(startDate);
240+
userEvent.type(startDate, '12/26/1967');
241+
242+
// expect everything to be ok
243+
expect(endDate).toBeEnabled();
244+
});
215245
});
216246
});

frontend/src/pages/Landing/Components/DatePicker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function DatePicker({ query, onUpdateFilter, id }) {
5050
aria-label={'open calendar"'}
5151
type="button"
5252
unstyled
53-
className="margin-top-auto margin-bottom-auto smart-hub--filter-button smart-hub--filter-date-picker-button"
53+
className="margin-top-auto margin-bottom-auto font-sans-xs margin-left-1 smart-hub--filter-date-picker-button"
5454
>
5555
<FontAwesomeIcon size="1x" color="gray" icon={faCalendar} />
5656
</Button>

frontend/src/pages/Landing/Components/DateRangePicker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function DateRangePicker({
6969
onClick={() => { updateOpened(true); updateFocused('startDate'); }}
7070
aria-label={'open calendar"'}
7171
type="button"
72-
className="margin-top-auto margin-bottom-auto smart-hub--filter-button smart-hub--filter-date-picker-button"
72+
className="margin-top-auto margin-bottom-auto font-sans-xs margin-left-1 smart-hub--filter-date-picker-button"
7373
unstyled
7474
>
7575
<FontAwesomeIcon size="1x" color="gray" icon={faCalendar} />

frontend/src/pages/Landing/Filter.css

-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
vertical-align: bottom;
2525
}
2626

27-
.landing .smart-hub--filter-button {
28-
margin-left: 0px;
29-
font-size: 14px;
30-
}
31-
3227
.smart-hub--filter-menu-button:hover {
3328
color: black;
3429
text-decoration: none;

frontend/src/pages/Landing/Filter.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ function Filter({ applyFilters, forMyAlerts }) {
111111
onClick={() => {
112112
updateOpen(!open);
113113
}}
114-
className={`usa-button usa-button--outline smart-hub--filter-button smart-hub--table-controls__button ${filterClass}`}
114+
className={`usa-button usa-button--outline font-sans-xs margin-left-1 smart-hub--table-controls__button ${filterClass}`}
115115
>
116116
{`Filters ${filters.length > 0 ? `(${filters.length})` : ''}`}
117117
{' '}
118118
<FontAwesomeIcon className="margin-left-1" size="1x" style={{ paddingBottom: '2px' }} color="black" icon={faSortDown} />
119119
</button>
120120
{open && (
121-
<div role="menu" tabIndex={-1} onBlur={onMenuBlur} onKeyDown={onMenuKeyDown} ref={menuRef} className="z-400 position-absolute">
121+
<div role="menu" tabIndex={-1} onBlur={onMenuBlur} onKeyDown={onMenuKeyDown} ref={menuRef} className="z-400 left-0 position-absolute">
122122
<Container padding={2} className="margin-bottom-0">
123123
<div className="font-body-2xs">
124124
{hasFilters && (
@@ -152,7 +152,7 @@ function Filter({ applyFilters, forMyAlerts }) {
152152
<div className="height-20 margin-top-2 clearfix">
153153
<button
154154
type="button"
155-
className="usa-button usa-button--outline float-left smart-hub--filter-button"
155+
className="usa-button usa-button--outline float-left font-sans-xs margin-left-1"
156156
onClick={() => {
157157
updateFilters([...filters, defaultFilter()]);
158158
}}
@@ -162,7 +162,7 @@ function Filter({ applyFilters, forMyAlerts }) {
162162
{hasFilters && (
163163
<button
164164
type="button"
165-
className="usa-button float-right smart-hub--filter-button"
165+
className="usa-button float-right font-sans-xs margin-left-1"
166166
onClick={onApplyFilter}
167167
>
168168
Apply Filters

frontend/src/pages/Landing/FilterItem.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function FilterItem({
128128
<button
129129
type="button"
130130
aria-label="remove filter"
131-
className="usa-button usa-button--unstyled margin-right-1 smart-hub--filter-button"
131+
className="usa-button usa-button--unstyled font-sans-xs margin-right-1 margin-left-0"
132132
onClick={onRemoveFilter}
133133
>
134134
<FontAwesomeIcon color="gray" icon={faTimesCircle} />

frontend/src/pages/Landing/MyAlerts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function MyAlerts(props) {
234234

235235
{reports && (reports.length > 0 || hasFilters) && (
236236
<Container className="landing inline-size maxw-full" padding={0}>
237-
<span role="menubar" className="smart-hub--alerts-table-controls">
237+
<span className="smart-hub--alerts-table-controls display-flex flex-row flex-align-center">
238238
<Filter applyFilters={updateReportFilters} forMyAlerts />
239239
<ReportMenu
240240
label="My Alerts report menu"
@@ -264,7 +264,7 @@ function MyAlerts(props) {
264264
<Table className="usa-table usa-table--borderless" fullWidth>
265265
<caption className="smart-hub--table-caption">
266266
My activity report alerts
267-
<p id="arTblDesc">with sorting</p>
267+
<p className="usa-sr-only">with sorting</p>
268268
</caption>
269269
<thead>
270270
<tr>

frontend/src/pages/Landing/ReportMenu.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ function ReportMenu({
4343
};
4444

4545
return (
46-
<span>
46+
<span className="position-relative">
4747
<button
4848
ref={menuButtonRef}
4949
type="button"
5050
aria-haspopup="menu"
51-
className={`usa-button usa-button--outline smart-hub--filter-button smart-hub--table-controls__button ${openClass}`}
51+
className={`usa-button usa-button--outline font-sans-xs margin-left-1 smart-hub--table-controls__button ${openClass}`}
5252
aria-label={label}
5353
onClick={() => updateOpen((current) => !current)}
5454
>
@@ -63,7 +63,7 @@ function ReportMenu({
6363
/>
6464
</button>
6565
{open && (
66-
<div role="menu" tabIndex={-1} onBlur={onMenuBlur} onKeyDown={onMenuKeyDown} ref={menuRef} style={{ left: '85px' }} className="z-400 position-absolute width-card-lg">
66+
<div role="menu" tabIndex={-1} onBlur={onMenuBlur} onKeyDown={onMenuKeyDown} ref={menuRef} className="z-400 position-absolute left-0 width-card-lg">
6767
<Container padding={2} className="margin-bottom-0">
6868
<button
6969
role="menuitem"

frontend/src/pages/Landing/index.css

+1-31
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,8 @@ div.smart-hub--total-count {
7878
margin-top: 24px;
7979
}
8080

81-
.smart-hub--selected-tag {
82-
border-radius: 15px;
81+
.smart-hub-bg-vivid {
8382
background-color: #0166AB;
84-
padding: 5px;
85-
padding-right: 15px;
86-
padding-left: 15px;
87-
color: white;
88-
width: 65px;
89-
height: 13px;
90-
font-family: SourceSansPro;
91-
font-size: 14px;
92-
line-height: 26px;
9383
}
9484

9585
.landing .smart-hub--table-nav {
@@ -162,11 +152,6 @@ h1.landing {
162152
color: #3C72AE;
163153
}
164154

165-
.landing .usa-button {
166-
margin-left: 45px;
167-
vertical-align: middle;
168-
}
169-
170155
.landing .usa-alert .usa-alert--error {
171156
margin-bottom: 20px;
172157
background-color: #148439;
@@ -313,21 +298,6 @@ a.desc {
313298
padding-bottom: 15px;
314299
}
315300

316-
#arTblDesc {
317-
position:absolute;
318-
left:-10000px;
319-
top:auto;
320-
width:1px;
321-
height:1px;
322-
overflow:hidden;
323-
}
324-
325-
.landing .smart-hub--select-tag__button {
326-
margin-left: 0;
327-
vertical-align: none;
328-
margin-bottom: 3px;
329-
}
330-
331301
.landing .smart-hub--table-controls__button {
332302
color: black;
333303
text-decoration: none;

frontend/src/pages/Landing/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -505,16 +505,16 @@ function Landing() {
505505
/>
506506

507507
<Container className="landing inline-size maxw-full" padding={0}>
508-
<span className="smart-hub--table-controls">
508+
<span className="smart-hub--table-controls display-flex flex-row flex-align-center">
509509
{numberOfSelectedReports > 0
510510
&& (
511-
<span className="smart-hub--selected-tag margin-right-1">
511+
<span className="padding-y-05 padding-left-105 padding-right-1 text-white smart-hub-bg-vivid radius-pill font-sans-xs text-middle margin-right-1">
512512
{numberOfSelectedReports}
513513
{' '}
514514
selected
515515
{' '}
516516
<Button
517-
className="smart-hub--select-tag__button"
517+
className="smart-hub--select-tag__button margin-left-1"
518518
unstyled
519519
aria-label="deselect all reports"
520520
onClick={() => {
@@ -564,7 +564,7 @@ function Landing() {
564564
<Table className="usa-table usa-table--borderless usa-table--striped">
565565
<caption>
566566
Activity reports
567-
<p id="arTblDesc">with sorting and pagination</p>
567+
<p className="usa-sr-only">with sorting and pagination</p>
568568
</caption>
569569
<thead>
570570
<tr>

0 commit comments

Comments
 (0)