Skip to content

Commit

Permalink
Fixing unit tests to account for id added to date filters #772
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Glendenning committed Sep 3, 2021
1 parent a3206f6 commit e6236e9
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ exports[`Date filter component renders correctly 1`] = `
<PickerWithState
KeyboardButtonProps={
Object {
"aria-label": "test filter from date picker",
"aria-label": "test filter from, date picker",
"size": "small",
}
}
allowKeyboardControl={true}
aria-hidden="true"
color="secondary"
format="yyyy-MM-dd"
id="test filter from"
inputProps={
Object {
"aria-label": "test filter",
Expand Down Expand Up @@ -46,14 +47,15 @@ exports[`Date filter component renders correctly 1`] = `
<PickerWithState
KeyboardButtonProps={
Object {
"aria-label": "test filter to date picker",
"aria-label": "test filter to, date picker",
"size": "small",
}
}
allowKeyboardControl={true}
aria-hidden="true"
color="secondary"
format="yyyy-MM-dd"
id="test filter to"
inputProps={
Object {
"aria-label": "test filter",
Expand Down Expand Up @@ -93,14 +95,15 @@ exports[`Date filter component useTextFilter hook returns a function which can g
<PickerWithState
KeyboardButtonProps={
Object {
"aria-label": "Start Date filter from date picker",
"aria-label": "Start Date filter from, date picker",
"size": "small",
}
}
allowKeyboardControl={true}
aria-hidden="true"
color="secondary"
format="yyyy-MM-dd"
id="Start Date filter from"
inputProps={
Object {
"aria-label": "Start Date filter",
Expand Down Expand Up @@ -131,14 +134,15 @@ exports[`Date filter component useTextFilter hook returns a function which can g
<PickerWithState
KeyboardButtonProps={
Object {
"aria-label": "Start Date filter to date picker",
"aria-label": "Start Date filter to, date picker",
"size": "small",
}
}
allowKeyboardControl={true}
aria-hidden="true"
color="secondary"
format="yyyy-MM-dd"
id="Start Date filter to"
inputProps={
Object {
"aria-label": "Start Date filter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DateColumnFilter = (props: {
size: 'small',
'aria-label': `${props.label} filter from, date picker`,
}}
id="start date filter from"
id={props.label + ' filter from'}
aria-hidden="true"
format="yyyy-MM-dd"
placeholder="From..."
Expand All @@ -104,7 +104,7 @@ const DateColumnFilter = (props: {
size: 'small',
'aria-label': `${props.label} filter to, date picker`,
}}
id="start date filter to"
id={props.label + ' filter to'}
aria-hidden="true"
format="yyyy-MM-dd"
placeholder="To..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,17 @@ exports[`Data column header component renders correctly with filter but no sort
<Icon />
</Styled(MuiBox)>
<Styled(MuiBox)>
<div>
<label
id="column-label"
style={
Object {
"display": "none",
}
<WithStyles(ForwardRef(Typography))
noWrap={true}
style={
Object {
"fontSize": "inherit",
"lineHeight": "inherit",
}
>
Test
</label>
<WithStyles(ForwardRef(Typography))
aria-labelledby="column-label"
noWrap={true}
style={
Object {
"fontSize": "inherit",
"lineHeight": "inherit",
}
}
tabIndex={0}
>
Test
</WithStyles(ForwardRef(Typography))>
</div>
}
>
Test
</WithStyles(ForwardRef(Typography))>
</Styled(MuiBox)>
</Styled(MuiBox)>
<TextColumnFilter
Expand Down Expand Up @@ -305,31 +291,17 @@ exports[`Data column header component renders correctly without sort or filter 1
<Icon />
</Styled(MuiBox)>
<Styled(MuiBox)>
<div>
<label
id="column-label"
style={
Object {
"display": "none",
}
<WithStyles(ForwardRef(Typography))
noWrap={true}
style={
Object {
"fontSize": "inherit",
"lineHeight": "inherit",
}
>
Test
</label>
<WithStyles(ForwardRef(Typography))
aria-labelledby="column-label"
noWrap={true}
style={
Object {
"fontSize": "inherit",
"lineHeight": "inherit",
}
}
tabIndex={0}
>
Test
</WithStyles(ForwardRef(Typography))>
</div>
}
>
Test
</WithStyles(ForwardRef(Typography))>
</Styled(MuiBox)>
</Styled(MuiBox)>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ describe('PageContainer - Tests', () => {
history.replace(paths.toggle.investigation);

const wrapper = createWrapper();
console.log(wrapper.debug());

expect(
wrapper.find('[aria-label="page-view app.view_cards"]').exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('Datafile table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datafiles.modified_time filter to"]'
'input[id="datafiles.modified_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('Dataset table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datasets.modified_time filter to"]'
'input[id="datasets.modified_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`DLS Visits table component renders correctly 1`] = `
exports[`DLS MyData table component renders correctly 1`] = `
Object {
"classes": Object {
"flexContainer": "VirtualizedTable-flexContainer-2",
Expand Down Expand Up @@ -125,7 +125,7 @@ Object {
}
`;

exports[`DLS Visits table component renders title and visit ID as a links 1`] = `
exports[`DLS MyData table component renders title and visit ID as a links 1`] = `
<WithStyles(ForwardRef(Link))
component={
Object {
Expand Down Expand Up @@ -278,7 +278,7 @@ exports[`DLS Visits table component renders title and visit ID as a links 1`] =
</WithStyles(ForwardRef(Link))>
`;

exports[`DLS Visits table component renders title and visit ID as a links 2`] = `
exports[`DLS MyData table component renders title and visit ID as a links 2`] = `
<WithStyles(ForwardRef(Link))
component={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('DLS datafiles table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datafiles.create_time filter to"]'
'input[id="datafiles.create_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('DLS Dataset table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datasets.modified_time filter to"]'
'input[id="datasets.modified_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jest.mock('datagateway-common', () => {
};
});

describe('DLS Visits table component', () => {
describe('DLS MyData table component', () => {
let mount;
const mockStore = configureStore([thunk]);
let state: StateType;
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('DLS Visits table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="investigations.end_date filter to"]'
'input[id="investigations.end_date filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('DLS Visits table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="investigations.end_date filter to"]'
'input[id="investigations.end_date filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe('Investigation table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="investigations.start_date filter from"]'
'input[id="investigations.start_date filter from"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ISIS Investigations table component renders correctly 1`] = `
exports[`ISIS MyData table component renders correctly 1`] = `
Object {
"allIds": Array [
1,
Expand Down Expand Up @@ -179,7 +179,7 @@ Object {
}
`;

exports[`ISIS Investigations table component renders details panel correctly and it fetches data and can navigate 1`] = `
exports[`ISIS MyData table component renders details panel correctly and it fetches data and can navigate 1`] = `
<div
id="details-panel"
style={
Expand Down Expand Up @@ -346,7 +346,7 @@ exports[`ISIS Investigations table component renders details panel correctly and
</div>
`;

exports[`ISIS Investigations table component renders title and name as links 1`] = `
exports[`ISIS MyData table component renders title and name as links 1`] = `
<WithStyles(ForwardRef(Link))
component={
Object {
Expand Down Expand Up @@ -499,7 +499,7 @@ exports[`ISIS Investigations table component renders title and name as links 1`]
</WithStyles(ForwardRef(Link))>
`;

exports[`ISIS Investigations table component renders title and name as links 2`] = `
exports[`ISIS MyData table component renders title and name as links 2`] = `
<WithStyles(ForwardRef(Link))
component={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('ISIS datafiles table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datafiles.modified_time filter to"]'
'input[id="datafiles.modified_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe('ISIS Dataset table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="datasets.modified_time filter to"]'
'input[id="datasets.modified_time filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('ISIS FacilityCycles table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="facilitycycles.end_date filter to"]'
'input[id="facilitycycles.end_date filter to"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('ISIS Investigations table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="investigations.start_date filter from"]'
'input[id="investigations.start_date filter from"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jest.mock('datagateway-common', () => {
};
});

describe('ISIS Investigations table component', () => {
describe('ISIS MyData table component', () => {
let shallow;
let mount;
const mockStore = configureStore([thunk]);
Expand Down Expand Up @@ -275,7 +275,7 @@ describe('ISIS Investigations table component', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="investigations.start_date filter from"]'
'input[id="investigations.start_date filter from"]'
);
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ describe('ISIS Studies table component', () => {
it('updates filter query params on date filter', () => {
const wrapper = createWrapper();

const filterInput = wrapper.find(
'[aria-label="studies.end_date filter to"]'
);
const filterInput = wrapper.find('input[id="studies.end_date filter to"]');
filterInput.instance().value = '2019-08-06';
filterInput.simulate('change');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ describe('Admin Download Status Table', () => {

// Get the Requested Data From filter input
const dateFromFilterInput = wrapper.find(
'[aria-label="downloadStatus.createdAt filter from"]'
'input[id="downloadStatus.createdAt filter from"]'
);
await act(async () => {
dateFromFilterInput.instance().value = '2020-01-01';
Expand All @@ -387,7 +387,7 @@ describe('Admin Download Status Table', () => {

// Get the Requested Data To filter input
const dateToFilterInput = wrapper.find(
'[aria-label="downloadStatus.createdAt filter to"]'
'input[id="downloadStatus.createdAt filter to"]'
);
await act(async () => {
dateToFilterInput.instance().value = '2020-01-02';
Expand Down
Loading

0 comments on commit e6236e9

Please sign in to comment.