Skip to content

Commit 7624566

Browse files
committed
Fix tests
1 parent eaaae9a commit 7624566

3 files changed

Lines changed: 2 additions & 27 deletions

File tree

assets/js/api-search/src/reducer.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ export default (state, action) => {
3434
newState.args = { ...newState.args, ...args, offset: 0 };
3535
newState.isOn = true;
3636

37-
if (updateDefaults && args.post_type.length) {
38-
newState.argsSchema.post_type.default = args.post_type;
39-
}
40-
4137
break;
4238
}
4339
case 'SEARCH_FOR': {

assets/js/instant-results/apps/modal.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
88
* Internal dependencies.
99
*/
1010
import { useApiSearch } from '../../api-search';
11-
import { argsSchema, facets } from '../config';
11+
import { argsSchema } from '../config';
1212
import { getArgsFromForm } from '../utilities';
1313
import Modal from '../components/common/modal';
1414
import Layout from '../components/layout';
@@ -60,9 +60,8 @@ export default () => {
6060
}
6161

6262
const args = getArgsFromForm(inputRef.current.form, argsSchema);
63-
const updateDefaults = !facets.some((f) => f.name === 'post_type');
6463

65-
search({ ...args, updateDefaults });
64+
search(args);
6665
},
6766
[inputRef, search],
6867
);

assets/js/instant-results/utilities.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,6 @@ export const formatPrice = (number, options) => {
3636
return format.format(number);
3737
};
3838

39-
/**
40-
* Get the post types from a search form.
41-
*
42-
* @param {HTMLFormElement} form Form element.
43-
* @returns {Array} Post types.
44-
*/
45-
export const getPostTypesFromForm = (form) => {
46-
const data = new FormData(form);
47-
48-
if (data.has('post_type')) {
49-
return data.getAll('post_type').slice(-1);
50-
}
51-
52-
if (data.has('post_type[]')) {
53-
return data.getAll('post_type[]');
54-
}
55-
56-
return [];
57-
};
58-
5939
/**
6040
* Get search args from a search form for Instant Results.
6141
*

0 commit comments

Comments
 (0)