Skip to content

Commit

Permalink
fix: set default for in-depth search to false (#610)
Browse files Browse the repository at this point in the history
* fix: set default for in-depth search to false

* fix: tests

* fix: last test
  • Loading branch information
spaenleh authored May 6, 2024
1 parent d85ebd0 commit a41709f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cypress/e2e/allCollections/allCollections.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ buildPublicAndPrivateEnvironments(PUBLISHED_ITEMS).forEach((environment) => {
// 'License',
// );

// verify 6 item cards are displayed (including children)
// verify 2 item cards are displayed (without children)
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`);
cy.get(`[id^=${buildCollectionCardGridId('')}]`).should(
'have.length',
environment.items.length,
getRootPublishedItems(environment.items).length,
);

// verify 2 item cards are displayed (without children)
cy.get(`#${ENABLE_IN_DEPTH_SEARCH_CHECKBOX_ID}`).uncheck();
// verify 6 item cards are displayed (including children)
cy.get(`#${ENABLE_IN_DEPTH_SEARCH_CHECKBOX_ID}`).check();
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`);
cy.get(`[id^=${buildCollectionCardGridId('')}]`).should(
'have.length',
getRootPublishedItems(environment.items).length,
environment.items.length,
);
});

Expand Down Expand Up @@ -121,7 +121,7 @@ buildPublicAndPrivateEnvironments(PUBLISHED_ITEMS).forEach((environment) => {
cy.wait('@search').then(() => {
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`)
.children()
.should('have.length', PUBLISHED_ITEMS.length);
.should('have.length', getRootPublishedItems(PUBLISHED_ITEMS).length);
});

// bug: popup does not open in cypress
Expand All @@ -131,7 +131,7 @@ buildPublicAndPrivateEnvironments(PUBLISHED_ITEMS).forEach((environment) => {
// check default display, show all published with children
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`)
.children()
.should('have.length', PUBLISHED_ITEMS.length);
.should('have.length', getRootPublishedItems(PUBLISHED_ITEMS).length);
});
});
});
3 changes: 2 additions & 1 deletion cypress/e2e/home/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../../src/config/selectors';
import { buildPublicAndPrivateEnvironments } from '../../fixtures/environment';
import { PUBLISHED_ITEMS } from '../../fixtures/items';
import { getRootPublishedItems } from '../../support/utils';

// the text doesn't affect the result: results are set in setUpApi
const keywords = 'keywords';
Expand Down Expand Up @@ -47,7 +48,7 @@ describe('Search', () => {

// verify all items are displayed
// eslint-disable-next-line no-restricted-syntax
for (const item of PUBLISHED_ITEMS) {
for (const item of getRootPublishedItems(PUBLISHED_ITEMS)) {
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`).contains(item.name);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/AllCollections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const AllCollections: React.FC<AllCollectionsProps> = () => {

const [filters, setFilters] = useState<string[][]>([]);
const [shouldIncludeContent, setShouldIncludeContent] =
useState<boolean>(true);
useState<boolean>(false);
const [searchKeywords, setSearchKeywords] = useState<string>('');
const [prevResults, setPrevResults] = useState<ItemOrSearchedItem[]>([]);
const [page, setPage] = useState<number>(1);
Expand Down

0 comments on commit a41709f

Please sign in to comment.