vue-instantsearch 4.17.0 → 4.17.2
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 +5 -5
- package/src/__tests__/common-widgets.test.js +3 -0
- package/src/components/Hits.js +2 -5
- package/src/components/InfiniteHits.vue +2 -7
- package/src/components/RatingMenu.vue +36 -34
- package/src/components/__tests__/Hits.js +1 -1
- package/src/components/__tests__/InfiniteHits.js +1 -168
- package/src/components/__tests__/RatingMenu.js +0 -117
- package/src/components/__tests__/__snapshots__/InfiniteHits.js.snap +0 -110
- 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/Hits.js +1 -1
- package/vue2/es/src/components/Hits.js.map +1 -1
- package/vue2/es/src/components/InfiniteHits.vue.js +1 -1
- package/vue2/es/src/components/InfiniteHits.vue_rollup-plugin-vue=script.js +1 -1
- package/vue2/es/src/components/RatingMenu.vue.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/Hits.js +1 -1
- package/vue3/es/src/components/Hits.js.map +1 -1
- package/vue3/es/src/components/InfiniteHits.vue.js +1 -1
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=script&lang.js +1 -1
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=template&id=1b2a109e&lang.js +2 -0
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=template&id=1b2a109e&lang.js.map +1 -0
- package/vue3/es/src/components/RatingMenu.vue.js +1 -1
- package/vue3/es/src/components/RatingMenu.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/RatingMenu.vue_vue&type=template&id=c025dd38&lang.js +2 -0
- package/vue3/es/src/components/RatingMenu.vue_vue&type=template&id=c025dd38&lang.js.map +1 -0
- package/vue3/umd/index.js +1 -1
- package/vue3/umd/index.js.map +1 -1
- package/src/components/__tests__/__snapshots__/RatingMenu.js.snap +0 -487
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=template&id=39939af3&lang.js +0 -2
- package/vue3/es/src/components/InfiniteHits.vue_vue&type=template&id=39939af3&lang.js.map +0 -1
- package/vue3/es/src/components/RatingMenu.vue_vue&type=template&id=6effe1ff&lang.js +0 -2
- package/vue3/es/src/components/RatingMenu.vue_vue&type=template&id=6effe1ff&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.17.
|
|
19
|
+
"version": "4.17.2",
|
|
20
20
|
"files": [
|
|
21
21
|
"vue2",
|
|
22
22
|
"vue3",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"instantsearch-ui-components": "0.6.0",
|
|
40
|
-
"instantsearch.js": "4.
|
|
40
|
+
"instantsearch.js": "4.71.0",
|
|
41
41
|
"mitt": "^2.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@vue/test-utils": "1.3.0",
|
|
63
63
|
"@vue/test-utils2": "npm:@vue/test-utils@2.0.0-rc.11",
|
|
64
64
|
"algoliasearch": "4.23.2",
|
|
65
|
-
"algoliasearch-helper": "3.
|
|
66
|
-
"instantsearch.css": "8.2.
|
|
65
|
+
"algoliasearch-helper": "3.21.0",
|
|
66
|
+
"instantsearch.css": "8.2.1",
|
|
67
67
|
"rollup": "1.32.1",
|
|
68
68
|
"rollup-plugin-babel": "4.4.0",
|
|
69
69
|
"rollup-plugin-buble": "0.19.6",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"vuex": "3.5.1",
|
|
90
90
|
"vuex4": "npm:vuex@4.0.0"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "3707501a19e582e8263a3ae5a9d51ff3f5263361"
|
|
93
93
|
}
|
|
@@ -174,6 +174,9 @@ const testSetups = {
|
|
|
174
174
|
),
|
|
175
175
|
},
|
|
176
176
|
}),
|
|
177
|
+
h('div', { attrs: { id: 'hits-with-defaults' } }, [
|
|
178
|
+
h(AisInfiniteHits, { props: widgetParams }),
|
|
179
|
+
]),
|
|
177
180
|
h(AisIndex, { props: { indexName: 'nested' } }, [
|
|
178
181
|
h(AisInfiniteHits, {
|
|
179
182
|
attrs: { id: 'nested-hits' },
|
package/src/components/Hits.js
CHANGED
|
@@ -29,9 +29,6 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
computed: {
|
|
32
|
-
items() {
|
|
33
|
-
return this.state.hits;
|
|
34
|
-
},
|
|
35
32
|
widgetParams() {
|
|
36
33
|
return {
|
|
37
34
|
escapeHTML: this.escapeHTML,
|
|
@@ -91,7 +88,7 @@ export default {
|
|
|
91
88
|
},
|
|
92
89
|
[
|
|
93
90
|
defaultSlot({
|
|
94
|
-
items: this.state.
|
|
91
|
+
items: this.state.items,
|
|
95
92
|
insights: this.state.insights,
|
|
96
93
|
sendEvent: this.state.sendEvent,
|
|
97
94
|
}),
|
|
@@ -100,7 +97,7 @@ export default {
|
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
return h(createHitsComponent({ createElement: h }), {
|
|
103
|
-
hits: this.state.
|
|
100
|
+
hits: this.state.items,
|
|
104
101
|
itemComponent,
|
|
105
102
|
sendEvent: this.state.sendEvent,
|
|
106
103
|
classNames: this.classNames && {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</slot>
|
|
21
21
|
|
|
22
22
|
<slot
|
|
23
|
-
:items="items"
|
|
23
|
+
:items="state.items"
|
|
24
24
|
:results="state.results"
|
|
25
25
|
:is-last-page="state.isLastPage"
|
|
26
26
|
:refine-previous="refinePrevious"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
>
|
|
32
32
|
<ol :class="suit('list')">
|
|
33
33
|
<li
|
|
34
|
-
v-for="(item, index) in items"
|
|
34
|
+
v-for="(item, index) in state.items"
|
|
35
35
|
:class="suit('item')"
|
|
36
36
|
:key="item.objectID"
|
|
37
37
|
@click="state.sendEvent('click:internal', item, 'Hit Clicked')"
|
|
@@ -117,11 +117,6 @@ export default {
|
|
|
117
117
|
cache: this.cache,
|
|
118
118
|
};
|
|
119
119
|
},
|
|
120
|
-
items() {
|
|
121
|
-
// Fixes InstantSearch.js connectors API: every list
|
|
122
|
-
// of things must be called `items`
|
|
123
|
-
return this.state.hits;
|
|
124
|
-
},
|
|
125
120
|
},
|
|
126
121
|
methods: {
|
|
127
122
|
refinePrevious() {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:send-event="state.sendEvent"
|
|
8
8
|
:can-refine="state.canRefine"
|
|
9
9
|
>
|
|
10
|
-
<svg
|
|
10
|
+
<svg style="display: none">
|
|
11
11
|
<symbol id="ais-RatingMenu-starSymbol" viewBox="0 0 24 24">
|
|
12
12
|
<path
|
|
13
13
|
d="M12 .288l2.833 8.718h9.167l-7.417 5.389 2.833 8.718-7.416-5.388-7.417 5.388 2.833-8.718-7.416-5.389h9.167z"
|
|
@@ -26,41 +26,43 @@
|
|
|
26
26
|
:key="key"
|
|
27
27
|
:class="[suit('item'), item.isRefined && suit('item', 'selected')]"
|
|
28
28
|
>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
<div>
|
|
30
|
+
<a
|
|
31
|
+
:href="state.createURL(item.value)"
|
|
32
|
+
:aria-label="`${item.value} & up`"
|
|
33
|
+
:class="suit('link')"
|
|
34
|
+
@click.prevent="state.refine(item.value)"
|
|
35
|
+
>
|
|
36
|
+
<template v-for="(full, n) in item.stars">
|
|
37
|
+
<svg
|
|
38
|
+
v-if="full"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
width="24"
|
|
41
|
+
height="24"
|
|
42
|
+
:class="[suit('starIcon'), suit('starIcon--full')]"
|
|
43
|
+
:key="n + '-full'"
|
|
44
|
+
>
|
|
45
|
+
<use xlink:href="#ais-RatingMenu-starSymbol" />
|
|
46
|
+
</svg>
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
<svg
|
|
49
|
+
v-else
|
|
50
|
+
:class="[suit('starIcon'), suit('starIcon--empty')]"
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
width="24"
|
|
53
|
+
height="24"
|
|
54
|
+
:key="n + '-empty'"
|
|
55
|
+
>
|
|
56
|
+
<use xlink:href="#ais-RatingMenu-starEmptySymbol" />
|
|
57
|
+
</svg>
|
|
58
|
+
</template>
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
<span :class="suit('label')" aria-hidden="true">
|
|
61
|
+
<slot name="andUp">& Up</slot>
|
|
62
|
+
</span>
|
|
63
|
+
<span :class="suit('count')">{{ item.count }}</span>
|
|
64
|
+
</a>
|
|
65
|
+
</div>
|
|
64
66
|
</li>
|
|
65
67
|
</ul>
|
|
66
68
|
</slot>
|
|
@@ -16,7 +16,7 @@ const defaultState = {
|
|
|
16
16
|
transformItems: (items) => items,
|
|
17
17
|
},
|
|
18
18
|
sendEvent: jest.fn(),
|
|
19
|
-
|
|
19
|
+
items: [
|
|
20
20
|
{
|
|
21
21
|
objectID: '00001',
|
|
22
22
|
},
|
|
@@ -42,79 +42,6 @@ const defaultState = {
|
|
|
42
42
|
showPrevious: () => {},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
it('accepts a escapeHTML prop', () => {
|
|
46
|
-
__setState({
|
|
47
|
-
...defaultState,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const wrapper = mount(InfiniteHits, {
|
|
51
|
-
propsData: {
|
|
52
|
-
escapeHTML: true,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
expect(wrapper.vm.widgetParams.escapeHTML).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('accepts a transformItems prop', () => {
|
|
60
|
-
__setState({
|
|
61
|
-
...defaultState,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const transformItems = () => {};
|
|
65
|
-
|
|
66
|
-
const wrapper = mount(InfiniteHits, {
|
|
67
|
-
propsData: {
|
|
68
|
-
transformItems,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
expect(wrapper.vm.widgetParams.transformItems).toBe(transformItems);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('accepts a showPrevious prop', () => {
|
|
76
|
-
__setState({
|
|
77
|
-
...defaultState,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const wrapper = mount(InfiniteHits, {
|
|
81
|
-
propsData: {
|
|
82
|
-
showPrevious: true,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
expect(wrapper.vm.widgetParams.showPrevious).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('accepts a cache prop', () => {
|
|
90
|
-
__setState({
|
|
91
|
-
...defaultState,
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const cache = {
|
|
95
|
-
read: () => {},
|
|
96
|
-
write: () => {},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const wrapper = mount(InfiniteHits, {
|
|
100
|
-
propsData: {
|
|
101
|
-
cache,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
expect(wrapper.vm.widgetParams.cache).toEqual(cache);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('renders correctly', () => {
|
|
109
|
-
__setState({
|
|
110
|
-
...defaultState,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const wrapper = mount(InfiniteHits);
|
|
114
|
-
|
|
115
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
45
|
it('renders correctly with a custom rendering', () => {
|
|
119
46
|
__setState({
|
|
120
47
|
...defaultState,
|
|
@@ -159,100 +86,6 @@ it('renders correctly with a custom item rendering', () => {
|
|
|
159
86
|
expect(wrapper.html()).toMatchSnapshot();
|
|
160
87
|
});
|
|
161
88
|
|
|
162
|
-
it('renders correctly on the first page', () => {
|
|
163
|
-
__setState({
|
|
164
|
-
...defaultState,
|
|
165
|
-
isFirstPage: true,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
const wrapper = mount(InfiniteHits, {
|
|
169
|
-
propsData: {
|
|
170
|
-
showPrevious: true,
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const previousButton = wrapper.find('.ais-InfiniteHits-loadPrevious');
|
|
175
|
-
|
|
176
|
-
expect(previousButton.exists()).toEqual(true);
|
|
177
|
-
expect(
|
|
178
|
-
previousButton.classes('ais-InfiniteHits-loadPrevious--disabled')
|
|
179
|
-
).toEqual(true);
|
|
180
|
-
expect(previousButton).vueToBeDisabled();
|
|
181
|
-
expect(wrapper.htmlCompat()).toMatchSnapshot();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('renders correctly on the last page', () => {
|
|
185
|
-
__setState({
|
|
186
|
-
...defaultState,
|
|
187
|
-
isLastPage: true,
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
const wrapper = mount(InfiniteHits);
|
|
191
|
-
|
|
192
|
-
expect(wrapper.htmlCompat()).toMatchSnapshot();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('renders correctly when not on the first page', () => {
|
|
196
|
-
__setState({
|
|
197
|
-
...defaultState,
|
|
198
|
-
isFirstPage: false,
|
|
199
|
-
isLastPage: false,
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
const wrapper = mount(InfiniteHits, {
|
|
203
|
-
propsData: {
|
|
204
|
-
showPrevious: true,
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
const previousButton = wrapper.find('.ais-InfiniteHits-loadPrevious');
|
|
209
|
-
|
|
210
|
-
expect(previousButton.exists()).toEqual(true);
|
|
211
|
-
expect(
|
|
212
|
-
previousButton.classes('ais-InfiniteHits-loadPrevious--disabled')
|
|
213
|
-
).toEqual(false);
|
|
214
|
-
expect(previousButton.attributes('disabled')).toEqual(undefined);
|
|
215
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('expect to call showPrevious on click', async () => {
|
|
219
|
-
const showPrevious = jest.fn();
|
|
220
|
-
|
|
221
|
-
__setState({
|
|
222
|
-
...defaultState,
|
|
223
|
-
showPrevious,
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const wrapper = mount(InfiniteHits, {
|
|
227
|
-
propsData: {
|
|
228
|
-
showPrevious: true,
|
|
229
|
-
},
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
expect(showPrevious).toHaveBeenCalledTimes(0);
|
|
233
|
-
|
|
234
|
-
await wrapper.find('.ais-InfiniteHits-loadPrevious').trigger('click');
|
|
235
|
-
|
|
236
|
-
expect(showPrevious).toHaveBeenCalledTimes(1);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
it('expect to call showMore on click', async () => {
|
|
240
|
-
const showMore = jest.fn();
|
|
241
|
-
|
|
242
|
-
__setState({
|
|
243
|
-
...defaultState,
|
|
244
|
-
showMore,
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
const wrapper = mount(InfiniteHits);
|
|
248
|
-
|
|
249
|
-
expect(showMore).not.toHaveBeenCalled();
|
|
250
|
-
|
|
251
|
-
await wrapper.find('.ais-InfiniteHits-loadMore').trigger('click');
|
|
252
|
-
|
|
253
|
-
expect(showMore).toHaveBeenCalled();
|
|
254
|
-
});
|
|
255
|
-
|
|
256
89
|
it('exposes insights prop to the default slot', async () => {
|
|
257
90
|
const insights = jest.fn();
|
|
258
91
|
|
|
@@ -14,123 +14,6 @@ const defaultProps = {
|
|
|
14
14
|
attribute: 'popularity',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
it('renders correctly', () => {
|
|
18
|
-
__setState({
|
|
19
|
-
createURL: () => '#',
|
|
20
|
-
items: [
|
|
21
|
-
{
|
|
22
|
-
isRefined: false,
|
|
23
|
-
count: 20,
|
|
24
|
-
value: '1',
|
|
25
|
-
stars: [true, false, false, false, false],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
isRefined: false,
|
|
29
|
-
count: 3,
|
|
30
|
-
value: '2',
|
|
31
|
-
stars: [true, true, false, false, false],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
isRefined: false,
|
|
35
|
-
count: 2000,
|
|
36
|
-
value: '3',
|
|
37
|
-
stars: [true, true, true, false, false],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
isRefined: false,
|
|
41
|
-
count: 8,
|
|
42
|
-
value: '4',
|
|
43
|
-
stars: [true, true, true, true, false],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const wrapper = mount(RatingMenu, {
|
|
49
|
-
propsData: defaultProps,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('renders correctly when refined', () => {
|
|
56
|
-
__setState({
|
|
57
|
-
createURL: () => '#',
|
|
58
|
-
items: [
|
|
59
|
-
{
|
|
60
|
-
isRefined: false,
|
|
61
|
-
count: 20,
|
|
62
|
-
value: '1',
|
|
63
|
-
stars: [true, false, false, false, false],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
isRefined: false,
|
|
67
|
-
count: 3,
|
|
68
|
-
value: '2',
|
|
69
|
-
stars: [true, true, false, false, false],
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
isRefined: false,
|
|
73
|
-
count: 2000,
|
|
74
|
-
value: '3',
|
|
75
|
-
stars: [true, true, true, false, false],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
isRefined: true,
|
|
79
|
-
count: 8,
|
|
80
|
-
value: '4',
|
|
81
|
-
stars: [true, true, true, true, false],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const wrapper = mount(RatingMenu, {
|
|
87
|
-
propsData: defaultProps,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('calls refine when clicked on link', async () => {
|
|
94
|
-
__setState({
|
|
95
|
-
createURL: () => '#',
|
|
96
|
-
items: [
|
|
97
|
-
{
|
|
98
|
-
isRefined: false,
|
|
99
|
-
count: 20,
|
|
100
|
-
value: '1',
|
|
101
|
-
stars: [true, false, false, false, false],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
isRefined: false,
|
|
105
|
-
count: 3,
|
|
106
|
-
value: '2',
|
|
107
|
-
stars: [true, true, false, false, false],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
isRefined: false,
|
|
111
|
-
count: 2000,
|
|
112
|
-
value: '3',
|
|
113
|
-
stars: [true, true, true, false, false],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
isRefined: false,
|
|
117
|
-
count: 8,
|
|
118
|
-
value: '4',
|
|
119
|
-
stars: [true, true, true, true, false],
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
refine: jest.fn(),
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const wrapper = mount(RatingMenu, {
|
|
126
|
-
propsData: defaultProps,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
await wrapper.find('.ais-RatingMenu-link').trigger('click');
|
|
130
|
-
|
|
131
|
-
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith('1');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
17
|
it('exposes send-event method for insights middleware', async () => {
|
|
135
18
|
const sendEvent = jest.fn();
|
|
136
19
|
__setState({
|
|
@@ -1,115 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`renders correctly 1`] = `
|
|
4
|
-
<div class="ais-InfiniteHits">
|
|
5
|
-
<ol class="ais-InfiniteHits-list">
|
|
6
|
-
<li class="ais-InfiniteHits-item">
|
|
7
|
-
objectID: 00001, index: 0
|
|
8
|
-
</li>
|
|
9
|
-
<li class="ais-InfiniteHits-item">
|
|
10
|
-
objectID: 00002, index: 1
|
|
11
|
-
</li>
|
|
12
|
-
<li class="ais-InfiniteHits-item">
|
|
13
|
-
objectID: 00003, index: 2
|
|
14
|
-
</li>
|
|
15
|
-
<li class="ais-InfiniteHits-item">
|
|
16
|
-
objectID: 00004, index: 3
|
|
17
|
-
</li>
|
|
18
|
-
<li class="ais-InfiniteHits-item">
|
|
19
|
-
objectID: 00005, index: 4
|
|
20
|
-
</li>
|
|
21
|
-
</ol>
|
|
22
|
-
<button class="ais-InfiniteHits-loadMore">
|
|
23
|
-
Show more results
|
|
24
|
-
</button>
|
|
25
|
-
</div>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
exports[`renders correctly on the first page 1`] = `
|
|
29
|
-
<div class="ais-InfiniteHits">
|
|
30
|
-
<button class="ais-InfiniteHits-loadPrevious ais-InfiniteHits-loadPrevious--disabled"
|
|
31
|
-
disabled="disabled"
|
|
32
|
-
>
|
|
33
|
-
Show previous results
|
|
34
|
-
</button>
|
|
35
|
-
<ol class="ais-InfiniteHits-list">
|
|
36
|
-
<li class="ais-InfiniteHits-item">
|
|
37
|
-
objectID: 00001, index: 0
|
|
38
|
-
</li>
|
|
39
|
-
<li class="ais-InfiniteHits-item">
|
|
40
|
-
objectID: 00002, index: 1
|
|
41
|
-
</li>
|
|
42
|
-
<li class="ais-InfiniteHits-item">
|
|
43
|
-
objectID: 00003, index: 2
|
|
44
|
-
</li>
|
|
45
|
-
<li class="ais-InfiniteHits-item">
|
|
46
|
-
objectID: 00004, index: 3
|
|
47
|
-
</li>
|
|
48
|
-
<li class="ais-InfiniteHits-item">
|
|
49
|
-
objectID: 00005, index: 4
|
|
50
|
-
</li>
|
|
51
|
-
</ol>
|
|
52
|
-
<button class="ais-InfiniteHits-loadMore">
|
|
53
|
-
Show more results
|
|
54
|
-
</button>
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
exports[`renders correctly on the last page 1`] = `
|
|
59
|
-
<div class="ais-InfiniteHits">
|
|
60
|
-
<ol class="ais-InfiniteHits-list">
|
|
61
|
-
<li class="ais-InfiniteHits-item">
|
|
62
|
-
objectID: 00001, index: 0
|
|
63
|
-
</li>
|
|
64
|
-
<li class="ais-InfiniteHits-item">
|
|
65
|
-
objectID: 00002, index: 1
|
|
66
|
-
</li>
|
|
67
|
-
<li class="ais-InfiniteHits-item">
|
|
68
|
-
objectID: 00003, index: 2
|
|
69
|
-
</li>
|
|
70
|
-
<li class="ais-InfiniteHits-item">
|
|
71
|
-
objectID: 00004, index: 3
|
|
72
|
-
</li>
|
|
73
|
-
<li class="ais-InfiniteHits-item">
|
|
74
|
-
objectID: 00005, index: 4
|
|
75
|
-
</li>
|
|
76
|
-
</ol>
|
|
77
|
-
<button class="ais-InfiniteHits-loadMore ais-InfiniteHits-loadMore--disabled"
|
|
78
|
-
disabled="disabled"
|
|
79
|
-
>
|
|
80
|
-
Show more results
|
|
81
|
-
</button>
|
|
82
|
-
</div>
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
exports[`renders correctly when not on the first page 1`] = `
|
|
86
|
-
<div class="ais-InfiniteHits">
|
|
87
|
-
<button class="ais-InfiniteHits-loadPrevious">
|
|
88
|
-
Show previous results
|
|
89
|
-
</button>
|
|
90
|
-
<ol class="ais-InfiniteHits-list">
|
|
91
|
-
<li class="ais-InfiniteHits-item">
|
|
92
|
-
objectID: 00001, index: 0
|
|
93
|
-
</li>
|
|
94
|
-
<li class="ais-InfiniteHits-item">
|
|
95
|
-
objectID: 00002, index: 1
|
|
96
|
-
</li>
|
|
97
|
-
<li class="ais-InfiniteHits-item">
|
|
98
|
-
objectID: 00003, index: 2
|
|
99
|
-
</li>
|
|
100
|
-
<li class="ais-InfiniteHits-item">
|
|
101
|
-
objectID: 00004, index: 3
|
|
102
|
-
</li>
|
|
103
|
-
<li class="ais-InfiniteHits-item">
|
|
104
|
-
objectID: 00005, index: 4
|
|
105
|
-
</li>
|
|
106
|
-
</ol>
|
|
107
|
-
<button class="ais-InfiniteHits-loadMore">
|
|
108
|
-
Show more results
|
|
109
|
-
</button>
|
|
110
|
-
</div>
|
|
111
|
-
`;
|
|
112
|
-
|
|
113
3
|
exports[`renders correctly with a custom item rendering 1`] = `
|
|
114
4
|
<div class="ais-InfiniteHits">
|
|
115
5
|
<ol class="ais-InfiniteHits-list">
|