vue-instantsearch 4.10.4 → 4.10.6

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.
@@ -1,329 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import {
5
- createRefinementListTests,
6
- createHierarchicalMenuTests,
7
- createBreadcrumbTests,
8
- createMenuTests,
9
- createPaginationTests,
10
- createInfiniteHitsTests,
11
- createHitsTests,
12
- createRangeInputTests,
13
- createInstantSearchTests,
14
- } from '@instantsearch/tests';
15
-
16
- import { nextTick, mountApp } from '../../test/utils';
17
- import { renderCompat } from '../util/vue-compat';
18
- import {
19
- AisInstantSearch,
20
- AisRefinementList,
21
- AisHierarchicalMenu,
22
- AisBreadcrumb,
23
- AisMenu,
24
- AisPagination,
25
- AisInfiniteHits,
26
- AisSearchBox,
27
- createWidgetMixin,
28
- AisHits,
29
- AisIndex,
30
- AisRangeInput,
31
- } from '../instantsearch';
32
- jest.unmock('instantsearch.js/es');
33
-
34
- /**
35
- * prevent rethrowing InstantSearch errors, so tests can be asserted.
36
- * IRL this isn't needed, as the error doesn't stop execution.
37
- */
38
- const GlobalErrorSwallower = {
39
- mixins: [createWidgetMixin({ connector: true })],
40
- mounted() {
41
- this.instantSearchInstance.on('error', () => {});
42
- },
43
- render() {
44
- return null;
45
- },
46
- };
47
-
48
- createRefinementListTests(async ({ instantSearchOptions, widgetParams }) => {
49
- mountApp(
50
- {
51
- render: renderCompat((h) =>
52
- h(AisInstantSearch, { props: instantSearchOptions }, [
53
- h(AisRefinementList, { props: widgetParams }),
54
- h(GlobalErrorSwallower),
55
- ])
56
- ),
57
- },
58
- document.body.appendChild(document.createElement('div'))
59
- );
60
-
61
- await nextTick();
62
- });
63
-
64
- createHierarchicalMenuTests(async ({ instantSearchOptions, widgetParams }) => {
65
- mountApp(
66
- {
67
- render: renderCompat((h) =>
68
- h(AisInstantSearch, { props: instantSearchOptions }, [
69
- h(AisHierarchicalMenu, { props: widgetParams }),
70
- h(GlobalErrorSwallower),
71
- ])
72
- ),
73
- },
74
- document.body.appendChild(document.createElement('div'))
75
- );
76
-
77
- await nextTick();
78
- });
79
-
80
- createBreadcrumbTests(async ({ instantSearchOptions, widgetParams }) => {
81
- // The passed `transformItems` prop is meant to apply only to the breadcrumb,
82
- // not the hierarchical menu
83
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
84
- const { transformItems, ...hierarchicalWidgetParams } = widgetParams;
85
-
86
- mountApp(
87
- {
88
- render: renderCompat((h) =>
89
- h(AisInstantSearch, { props: instantSearchOptions }, [
90
- h(AisBreadcrumb, { props: widgetParams }),
91
- h(AisHierarchicalMenu, { props: hierarchicalWidgetParams }),
92
- h(GlobalErrorSwallower),
93
- ])
94
- ),
95
- },
96
- document.body.appendChild(document.createElement('div'))
97
- );
98
-
99
- await nextTick();
100
- });
101
-
102
- createMenuTests(async ({ instantSearchOptions, widgetParams }) => {
103
- mountApp(
104
- {
105
- render: renderCompat((h) =>
106
- h(AisInstantSearch, { props: instantSearchOptions }, [
107
- h(AisMenu, { props: widgetParams }),
108
- h(GlobalErrorSwallower),
109
- ])
110
- ),
111
- },
112
- document.body.appendChild(document.createElement('div'))
113
- );
114
-
115
- await nextTick();
116
- });
117
-
118
- createPaginationTests(async ({ instantSearchOptions, widgetParams }) => {
119
- mountApp(
120
- {
121
- render: renderCompat((h) =>
122
- h(AisInstantSearch, { props: instantSearchOptions }, [
123
- h(AisPagination, { props: widgetParams }),
124
- h(GlobalErrorSwallower),
125
- ])
126
- ),
127
- },
128
- document.body.appendChild(document.createElement('div'))
129
- );
130
-
131
- await nextTick();
132
- });
133
-
134
- createInfiniteHitsTests(async ({ instantSearchOptions, widgetParams }) => {
135
- mountApp(
136
- {
137
- render: renderCompat((h) =>
138
- h(AisInstantSearch, { props: instantSearchOptions }, [
139
- h(AisSearchBox),
140
- h(AisInfiniteHits, {
141
- attrs: { id: 'main-hits' },
142
- props: widgetParams,
143
- scopedSlots: {
144
- item: ({ item: hit, sendEvent }) =>
145
- h(
146
- 'div',
147
- {
148
- attrs: {
149
- 'data-testid': `main-hits-top-level-${hit.__position}`,
150
- },
151
- },
152
- [
153
- hit.objectID,
154
- h('button', {
155
- attrs: {
156
- 'data-testid': `main-hits-convert-${hit.__position}`,
157
- },
158
- on: {
159
- click: () => sendEvent('conversion', hit, 'Converted'),
160
- },
161
- }),
162
- h('button', {
163
- attrs: {
164
- 'data-testid': `main-hits-click-${hit.__position}`,
165
- },
166
- on: {
167
- click: () => sendEvent('click', hit, 'Clicked'),
168
- },
169
- }),
170
- ]
171
- ),
172
- },
173
- }),
174
- h(AisIndex, { props: { indexName: 'nested' } }, [
175
- h(AisInfiniteHits, {
176
- attrs: { id: 'nested-hits' },
177
- scopedSlots: {
178
- item: ({ item: hit, sendEvent }) =>
179
- h(
180
- 'div',
181
- {
182
- attrs: {
183
- 'data-testid': `nested-hits-top-level-${hit.__position}`,
184
- },
185
- },
186
- [
187
- hit.objectID,
188
- h('button', {
189
- attrs: {
190
- 'data-testid': `nested-hits-click-${hit.__position}`,
191
- },
192
- on: {
193
- click: () =>
194
- sendEvent('click', hit, 'Clicked nested'),
195
- },
196
- }),
197
- ]
198
- ),
199
- },
200
- }),
201
- ]),
202
- h(GlobalErrorSwallower),
203
- ])
204
- ),
205
- },
206
- document.body.appendChild(document.createElement('div'))
207
- );
208
-
209
- await nextTick();
210
- });
211
-
212
- createHitsTests(async ({ instantSearchOptions, widgetParams }) => {
213
- mountApp(
214
- {
215
- render: renderCompat((h) =>
216
- h(AisInstantSearch, { props: instantSearchOptions }, [
217
- h(AisSearchBox),
218
- h(AisHits, {
219
- attrs: { id: 'main-hits' },
220
- props: widgetParams,
221
- scopedSlots: {
222
- item: ({ item: hit, sendEvent }) =>
223
- h(
224
- 'div',
225
- {
226
- attrs: {
227
- 'data-testid': `main-hits-top-level-${hit.__position}`,
228
- },
229
- },
230
- [
231
- hit.objectID,
232
- h('button', {
233
- attrs: {
234
- 'data-testid': `main-hits-convert-${hit.__position}`,
235
- },
236
- on: {
237
- click: () => sendEvent('conversion', hit, 'Converted'),
238
- },
239
- }),
240
- h('button', {
241
- attrs: {
242
- 'data-testid': `main-hits-click-${hit.__position}`,
243
- },
244
- on: {
245
- click: () => sendEvent('click', hit, 'Clicked'),
246
- },
247
- }),
248
- ]
249
- ),
250
- },
251
- }),
252
- h(AisIndex, { props: { indexName: 'nested' } }, [
253
- h(AisHits, {
254
- attrs: { id: 'nested-hits' },
255
- scopedSlots: {
256
- item: ({ item: hit, sendEvent }) =>
257
- h(
258
- 'div',
259
- {
260
- attrs: {
261
- 'data-testid': `nested-hits-top-level-${hit.__position}`,
262
- },
263
- },
264
- [
265
- hit.objectID,
266
- h('button', {
267
- attrs: {
268
- 'data-testid': `nested-hits-click-${hit.__position}`,
269
- },
270
- on: {
271
- click: () =>
272
- sendEvent('click', hit, 'Clicked nested'),
273
- },
274
- }),
275
- ]
276
- ),
277
- },
278
- }),
279
- ]),
280
- h(GlobalErrorSwallower),
281
- ])
282
- ),
283
- },
284
- document.body.appendChild(document.createElement('div'))
285
- );
286
-
287
- await nextTick();
288
- });
289
-
290
- createRangeInputTests(async ({ instantSearchOptions, widgetParams }) => {
291
- mountApp(
292
- {
293
- render: renderCompat((h) =>
294
- h(AisInstantSearch, { props: instantSearchOptions }, [
295
- h(AisRangeInput, { props: widgetParams }),
296
- h(GlobalErrorSwallower),
297
- ])
298
- ),
299
- },
300
- document.body.appendChild(document.createElement('div'))
301
- );
302
-
303
- await nextTick();
304
- });
305
-
306
- createInstantSearchTests(({ instantSearchOptions }) => {
307
- mountApp(
308
- {
309
- render: renderCompat((h) =>
310
- h(AisInstantSearch, { props: instantSearchOptions }, [
311
- h(GlobalErrorSwallower),
312
- ])
313
- ),
314
- },
315
- document.body.appendChild(document.createElement('div'))
316
- );
317
-
318
- return {
319
- algoliaAgents: [
320
- `instantsearch.js (${
321
- require('../../../instantsearch.js/package.json').version
322
- })`,
323
- `Vue InstantSearch (${
324
- require('../../../vue-instantsearch/package.json').version
325
- })`,
326
- `Vue (${require('../util/vue-compat').version})`,
327
- ],
328
- };
329
- });
@@ -1,2 +0,0 @@
1
- import{openBlock as e,createElementBlock as t,normalizeClass as s,renderSlot as n,createElementVNode as a,Fragment as u,renderList as i,toDisplayString as l,createCommentVNode as r}from"vue";var o=["value","selected"];function c(c,f,v,m,d,R){return c.state?(e(),t("div",{key:0,class:s(c.suit())},[n(c.$slots,"default",{items:c.state.items,refine:c.state.refine,hasNoResults:c.state.hasNoResults,canRefine:c.state.canRefine},function(){return[a("select",{class:s(c.suit("select")),onChange:f[0]||(f[0]=function(e){return c.state.refine(Number(e.currentTarget.value))})},[(e(!0),t(u,null,i(c.state.items,function(n){return e(),t("option",{key:n.value,class:s(c.suit("option")),value:n.value,selected:n.isRefined},l(n.label),11,o)}),128))],34)]})],2)):r("",!0)}export{c as render};
2
- //# sourceMappingURL=HitsPerPage.vue_vue&type=template&id=654e3b4a&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HitsPerPage.vue_vue&type=template&id=654e3b4a&lang.js","sources":["../../../../src/components/HitsPerPage.vue?vue&type=template&id=654e3b4a&lang.js"],"sourcesContent":["<template>\n <div v-if=\"state\" :class=\"suit()\">\n <slot\n :items=\"state.items\"\n :refine=\"state.refine\"\n :has-no-results=\"state.hasNoResults\"\n :can-refine=\"state.canRefine\"\n >\n <select\n :class=\"suit('select')\"\n @change=\"state.refine(Number($event.currentTarget.value))\"\n >\n <option\n v-for=\"item in state.items\"\n :key=\"item.value\"\n :class=\"suit('option')\"\n :value=\"item.value\"\n :selected=\"item.isRefined\"\n >\n {{ item.label }}\n </option>\n </select>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectHitsPerPage } from 'instantsearch.js/es/connectors';\nimport { createPanelConsumerMixin } from '../mixins/panel';\nimport { createWidgetMixin } from '../mixins/widget';\nimport { createSuitMixin } from '../mixins/suit';\n\nexport default {\n name: 'AisHitsPerPage',\n mixins: [\n createSuitMixin({ name: 'HitsPerPage' }),\n createWidgetMixin(\n {\n connector: connectHitsPerPage,\n },\n {\n $$widgetType: 'ais.hitsPerPage',\n }\n ),\n createPanelConsumerMixin(),\n ],\n props: {\n items: {\n type: Array,\n required: true,\n },\n transformItems: {\n type: Function,\n default: undefined,\n },\n },\n computed: {\n widgetParams() {\n return {\n items: this.items,\n transformItems: this.transformItems,\n };\n },\n },\n};\n</script>\n"],"names":["_ctx","_createElementBlock","class","_renderSlot","items","refine","hasNoResults","canRefine","_createElementVNode","onChange","Number","$event","currentTarget","value","item","key","selected","isRefined","label"],"mappings":"yPACaA,aAAXC,eAAmBC,QAAOF,YACxBG,sBACGC,MAAOJ,QAAMI,MACbC,OAAQL,QAAMK,OACdC,aAAgBN,QAAMM,aACtBC,UAAYP,QAAMO,6BAEnBC,YACGN,QAAOF,kBACPS,wCAAQT,QAAMK,OAAOK,OAAOC,EAAOC,cAAcC,mBAElDZ,WACiBD,QAAMI,eAAdU,cADTb,YAEGc,IAAKD,EAAKD,MACVX,QAAOF,kBACPa,MAAOC,EAAKD,MACZG,SAAUF,EAAKG,aAEbH,EAAKI"}