Skip to content

Commit

Permalink
test(searchbox): add common test suite (#5868)
Browse files Browse the repository at this point in the history

---------

Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
  • Loading branch information
aymeric-giraudet and dhayab authored Nov 3, 2023
1 parent cacb63f commit 5ad60bc
Show file tree
Hide file tree
Showing 26 changed files with 736 additions and 1,359 deletions.
2 changes: 1 addition & 1 deletion bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"path": "packages/vue-instantsearch/vue2/umd/index.js",
"maxSize": "63.75 kB"
"maxSize": "64 kB"
},
{
"path": "packages/vue-instantsearch/vue3/umd/index.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/instantsearch.js/src/__tests__/common-widgets.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ const testSetups: TestSetupsMap<TestSuites> = {
})
.start();
},
createSearchBoxWidgetTests({ instantSearchOptions, widgetParams }) {
instantsearch(instantSearchOptions)
.addWidgets([
searchBox({
container: document.body.appendChild(document.createElement('div')),
...widgetParams,
}),
])
.start();
},
};

const testOptions: TestOptionsMap<TestSuites> = {
Expand All @@ -387,6 +397,7 @@ const testOptions: TestOptionsMap<TestSuites> = {
createHitsPerPageWidgetTests: undefined,
createClearRefinementsWidgetTests: undefined,
createCurrentRefinementsWidgetTests: undefined,
createSearchBoxWidgetTests: undefined,
};

describe('Common widget tests (InstantSearch.js)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ exports[`RefinementList rendering with facets from search 1`] = `
/>
<button
class="submit"
title="Submit the search query."
title="Submit the search query"
type="submit"
>
submit
</button>
<button
class="reset"
hidden=""
title="Clear the search query."
title="Clear the search query"
type="reset"
>
reset
Expand Down Expand Up @@ -188,15 +188,15 @@ exports[`RefinementList rendering without facets from search 1`] = `
/>
<button
class="submit"
title="Submit the search query."
title="Submit the search query"
type="submit"
>
submit
</button>
<button
class="reset"
hidden=""
title="Clear the search query."
title="Clear the search query"
type="reset"
>
reset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class SearchBox extends Component<
rootProps={{
className: cssClasses.submit,
type: 'submit',
title: 'Submit the search query.',
title: 'Submit the search query',
hidden: !showSubmit,
}}
templates={templates}
Expand All @@ -208,7 +208,7 @@ class SearchBox extends Component<
rootProps={{
className: cssClasses.reset,
type: 'reset',
title: 'Clear the search query.',
title: 'Clear the search query',
hidden: !(
showReset &&
this.state.query.trim() &&
Expand Down
Loading

0 comments on commit 5ad60bc

Please sign in to comment.