vue-instantsearch 4.8.1 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/__tests__/common.test.js +20 -0
- package/src/components/HitsPerPage.vue +5 -11
- package/src/components/__tests__/HitsPerPage.js +7 -6
- package/src/components/__tests__/SortBy.js +11 -8
- package/vue2/cjs/index.js +1 -1
- package/vue2/cjs/index.js.map +1 -1
- package/vue2/es/package.json.js +1 -1
- package/vue2/es/src/components/HitsPerPage.vue.js +1 -1
- package/vue2/es/src/components/HitsPerPage.vue_rollup-plugin-vue=script.js +1 -1
- package/vue2/umd/index.js +1 -1
- package/vue2/umd/index.js.map +1 -1
- package/vue3/cjs/index.js +1 -1
- package/vue3/cjs/index.js.map +1 -1
- package/vue3/es/package.json.js +1 -1
- package/vue3/es/src/components/HitsPerPage.vue.js +1 -1
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=script&lang.js +1 -1
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=template&id=654e3b4a&lang.js +2 -0
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=template&id=654e3b4a&lang.js.map +1 -0
- package/vue3/umd/index.js +1 -1
- package/vue3/umd/index.js.map +1 -1
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=template&id=73c9813e&lang.js +0 -2
- package/vue3/es/src/components/HitsPerPage.vue_vue&type=template&id=73c9813e&lang.js.map +0 -1
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"autocomplete"
|
|
17
17
|
],
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"version": "4.8.
|
|
19
|
+
"version": "4.8.3",
|
|
20
20
|
"files": [
|
|
21
21
|
"vue2",
|
|
22
22
|
"vue3",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"test:exports:vue3": "node ./test/module/vue3/is-es-module.mjs && node ./test/module/vue3/is-cjs-module.cjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"instantsearch.js": "4.50.
|
|
38
|
+
"instantsearch.js": "4.50.3",
|
|
39
39
|
"mitt": "^2.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"vuex": "3.5.1",
|
|
86
86
|
"vuex4": "npm:vuex@4.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "cbcf03650d0bda8dd4f57f50e6c7e890e38c352a"
|
|
89
89
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createHierarchicalMenuTests,
|
|
7
7
|
createMenuTests,
|
|
8
8
|
createPaginationTests,
|
|
9
|
+
createInfiniteHitsTests,
|
|
9
10
|
} from '@instantsearch/tests';
|
|
10
11
|
|
|
11
12
|
import { nextTick, mountApp } from '../../test/utils';
|
|
@@ -16,6 +17,8 @@ import {
|
|
|
16
17
|
AisHierarchicalMenu,
|
|
17
18
|
AisMenu,
|
|
18
19
|
AisPagination,
|
|
20
|
+
AisInfiniteHits,
|
|
21
|
+
AisSearchBox,
|
|
19
22
|
createWidgetMixin,
|
|
20
23
|
} from '../instantsearch';
|
|
21
24
|
jest.unmock('instantsearch.js/es');
|
|
@@ -97,3 +100,20 @@ createPaginationTests(async ({ instantSearchOptions, widgetParams }) => {
|
|
|
97
100
|
|
|
98
101
|
await nextTick();
|
|
99
102
|
});
|
|
103
|
+
|
|
104
|
+
createInfiniteHitsTests(async ({ instantSearchOptions, widgetParams }) => {
|
|
105
|
+
mountApp(
|
|
106
|
+
{
|
|
107
|
+
render: renderCompat((h) =>
|
|
108
|
+
h(AisInstantSearch, { props: instantSearchOptions }, [
|
|
109
|
+
h(AisSearchBox),
|
|
110
|
+
h(AisInfiniteHits, { props: widgetParams }),
|
|
111
|
+
h(GlobalErrorSwallower),
|
|
112
|
+
])
|
|
113
|
+
),
|
|
114
|
+
},
|
|
115
|
+
document.body.appendChild(document.createElement('div'))
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
await nextTick();
|
|
119
|
+
});
|
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
:has-no-results="state.hasNoResults"
|
|
7
7
|
:can-refine="state.canRefine"
|
|
8
8
|
>
|
|
9
|
-
<select
|
|
9
|
+
<select
|
|
10
|
+
:class="suit('select')"
|
|
11
|
+
@change="state.refine(Number($event.currentTarget.value))"
|
|
12
|
+
>
|
|
10
13
|
<option
|
|
11
14
|
v-for="item in state.items"
|
|
12
15
|
:key="item.value"
|
|
13
16
|
:class="suit('option')"
|
|
14
17
|
:value="item.value"
|
|
18
|
+
:selected="item.isRefined"
|
|
15
19
|
>
|
|
16
20
|
{{ item.label }}
|
|
17
21
|
</option>
|
|
@@ -50,11 +54,6 @@ export default {
|
|
|
50
54
|
default: undefined,
|
|
51
55
|
},
|
|
52
56
|
},
|
|
53
|
-
data() {
|
|
54
|
-
return {
|
|
55
|
-
selected: this.items.find((item) => item.default === true).value,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
57
|
computed: {
|
|
59
58
|
widgetParams() {
|
|
60
59
|
return {
|
|
@@ -63,10 +62,5 @@ export default {
|
|
|
63
62
|
};
|
|
64
63
|
},
|
|
65
64
|
},
|
|
66
|
-
methods: {
|
|
67
|
-
handleChange() {
|
|
68
|
-
this.state.refine(this.selected);
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
65
|
};
|
|
72
66
|
</script>
|
|
@@ -6,6 +6,8 @@ import { mount } from '../../../test/utils';
|
|
|
6
6
|
import { __setState } from '../../mixins/widget';
|
|
7
7
|
import HitsPerPage from '../HitsPerPage.vue';
|
|
8
8
|
import '../../../test/utils/sortedHtmlSerializer';
|
|
9
|
+
import { getByRole } from '@testing-library/dom';
|
|
10
|
+
import userEvent from '@testing-library/user-event';
|
|
9
11
|
|
|
10
12
|
jest.mock('../../mixins/widget');
|
|
11
13
|
jest.mock('../../mixins/panel');
|
|
@@ -63,7 +65,7 @@ it('renders correctly', () => {
|
|
|
63
65
|
expect(wrapper.html()).toMatchSnapshot();
|
|
64
66
|
});
|
|
65
67
|
|
|
66
|
-
it('calls `refine` with the `value` on `change`',
|
|
68
|
+
it('calls `refine` with the `value` on `change`', () => {
|
|
67
69
|
__setState({
|
|
68
70
|
...defaultState,
|
|
69
71
|
refine: jest.fn(),
|
|
@@ -73,11 +75,10 @@ it('calls `refine` with the `value` on `change`', async () => {
|
|
|
73
75
|
propsData: defaultProps,
|
|
74
76
|
});
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
await wrapper.find('select').trigger('change');
|
|
78
|
+
userEvent.selectOptions(
|
|
79
|
+
getByRole(wrapper.element, 'combobox'),
|
|
80
|
+
getByRole(wrapper.element, 'option', { name: '20 results' })
|
|
81
|
+
);
|
|
81
82
|
|
|
82
83
|
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith(20);
|
|
83
84
|
});
|
|
@@ -6,6 +6,8 @@ import { mount } from '../../../test/utils';
|
|
|
6
6
|
import { __setState } from '../../mixins/widget';
|
|
7
7
|
import SortBy from '../SortBy.vue';
|
|
8
8
|
import '../../../test/utils/sortedHtmlSerializer';
|
|
9
|
+
import userEvent from '@testing-library/user-event';
|
|
10
|
+
import { getByRole } from '@testing-library/dom';
|
|
9
11
|
|
|
10
12
|
jest.mock('../../mixins/widget');
|
|
11
13
|
jest.mock('../../mixins/panel');
|
|
@@ -90,7 +92,7 @@ it('renders with scoped slots', () => {
|
|
|
90
92
|
expect(wrapper.html()).toMatchSnapshot();
|
|
91
93
|
});
|
|
92
94
|
|
|
93
|
-
it('calls `refine` when the selection changes with the `value`',
|
|
95
|
+
it('calls `refine` when the selection changes with the `value`', () => {
|
|
94
96
|
const refine = jest.fn();
|
|
95
97
|
__setState({
|
|
96
98
|
...defaultState,
|
|
@@ -101,14 +103,15 @@ it('calls `refine` when the selection changes with the `value`', async () => {
|
|
|
101
103
|
...defaultProps,
|
|
102
104
|
},
|
|
103
105
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const selectedOption = wrapper.find('option[value=some_index_quality]');
|
|
106
|
+
|
|
107
|
+
userEvent.selectOptions(
|
|
108
|
+
getByRole(wrapper.element, 'combobox'),
|
|
109
|
+
getByRole(wrapper.element, 'option', { name: 'Quality ascending' })
|
|
110
|
+
);
|
|
110
111
|
|
|
111
112
|
expect(refine).toHaveBeenCalledTimes(1);
|
|
112
113
|
expect(refine).toHaveBeenLastCalledWith('some_index_quality');
|
|
113
|
-
expect(
|
|
114
|
+
expect(
|
|
115
|
+
getByRole(wrapper.element, 'option', { name: 'Quality ascending' }).selected
|
|
116
|
+
).toBe(true);
|
|
114
117
|
});
|