vue-instantsearch 4.17.2 → 4.17.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 CHANGED
@@ -16,7 +16,7 @@
16
16
  "autocomplete"
17
17
  ],
18
18
  "license": "MIT",
19
- "version": "4.17.2",
19
+ "version": "4.17.3",
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.71.0",
40
+ "instantsearch.js": "4.71.1",
41
41
  "mitt": "^2.1.0"
42
42
  },
43
43
  "peerDependencies": {
@@ -89,5 +89,5 @@
89
89
  "vuex": "3.5.1",
90
90
  "vuex4": "npm:vuex@4.0.0"
91
91
  },
92
- "gitHead": "3707501a19e582e8263a3ae5a9d51ff3f5263361"
92
+ "gitHead": "443c2f875bd5ddd5cc94285b49c1e8c05df5e0f6"
93
93
  }
@@ -26,6 +26,8 @@ import {
26
26
  AisStats,
27
27
  AisRatingMenu,
28
28
  AisNumericMenu,
29
+ AisPoweredBy,
30
+ AisMenuSelect,
29
31
  } from '../instantsearch';
30
32
  import { renderCompat } from '../util/vue-compat';
31
33
 
@@ -520,6 +522,38 @@ const testSetups = {
520
522
  createLookingSimilarWidgetTests() {
521
523
  throw new Error('LookingSimilar is not supported in Vue InstantSearch');
522
524
  },
525
+ createPoweredByWidgetTests({ instantSearchOptions, widgetParams }) {
526
+ mountApp(
527
+ {
528
+ render: renderCompat((h) =>
529
+ h(AisInstantSearch, { props: instantSearchOptions }, [
530
+ h(AisPoweredBy, { props: widgetParams }),
531
+ h(GlobalErrorSwallower),
532
+ ])
533
+ ),
534
+ },
535
+ document.body.appendChild(document.createElement('div'))
536
+ );
537
+
538
+ return {
539
+ flavor: 'vue-instantsearch',
540
+ };
541
+ },
542
+ async createMenuSelectWidgetTests({ instantSearchOptions, widgetParams }) {
543
+ mountApp(
544
+ {
545
+ render: renderCompat((h) =>
546
+ h(AisInstantSearch, { props: instantSearchOptions }, [
547
+ h(AisMenuSelect, { props: widgetParams }),
548
+ h(GlobalErrorSwallower),
549
+ ])
550
+ ),
551
+ },
552
+ document.body.appendChild(document.createElement('div'))
553
+ );
554
+
555
+ await nextTick();
556
+ },
523
557
  };
524
558
 
525
559
  const testOptions = {
@@ -556,6 +590,7 @@ const testOptions = {
556
590
  createLookingSimilarWidgetTests: {
557
591
  skippedTests: { 'LookingSimilar widget common tests': true },
558
592
  },
593
+ createPoweredByWidgetTests: undefined,
559
594
  };
560
595
 
561
596
  describe('Common widget tests (Vue InstantSearch)', () => {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="suit()">
2
+ <div :class="[suit(), suit('', theme)]">
3
3
  <a
4
4
  :class="suit('link')"
5
5
  :href="algoliaUrl"
@@ -13,7 +13,7 @@
13
13
  viewBox="0 0 572 64"
14
14
  >
15
15
  <path
16
- :fill="theme === 'dark' ? '#FFF' : '#36395a'"
16
+ :fill="theme === 'dark' ? '#FFF' : '#36395A'"
17
17
  d="M16 48.3c-3.4 0-6.3-.6-8.7-1.7A12.4 12.4 0 0 1 1.9 42C.6 40 0 38 0 35.4h6.5a6.7 6.7 0 0 0 3.9 6c1.4.7 3.3 1.1 5.6 1.1 2.2 0 4-.3 5.4-1a7 7 0 0 0 3-2.4 6 6 0 0 0 1-3.4c0-1.5-.6-2.8-1.9-3.7-1.3-1-3.3-1.6-5.9-1.8l-4-.4c-3.7-.3-6.6-1.4-8.8-3.4a10 10 0 0 1-3.3-7.9c0-2.4.6-4.6 1.8-6.4a12 12 0 0 1 5-4.3c2.2-1 4.7-1.6 7.5-1.6s5.5.5 7.6 1.6a12 12 0 0 1 5 4.4c1.2 1.8 1.8 4 1.8 6.7h-6.5a6.4 6.4 0 0 0-3.5-5.9c-1-.6-2.6-1-4.4-1s-3.2.3-4.4 1c-1.1.6-2 1.4-2.6 2.4-.5 1-.8 2-.8 3.1a5 5 0 0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 1 6v1c0 2.2-.3 4.1-1 6a13.6 13.6 0 0 1-13.2 9.4Zm-1.2-5.5a8.4 8.4 0 0 0 7.9-5c.7-1.5 1.1-3.3 1.1-5.3s-.4-3.8-1.1-5.3a8.7 8.7 0 0 0-3.2-3.6 9.6 9.6 0 0 0-9.2-.2 8.5 8.5 0 0 0-3.3 3.2c-.8 1.4-1.3 3-1.3 5v2.3a9 9 0 0 0 1.3 4.8 9 9 0 0 0 3.4 3c1.4.7 2.8 1 4.4 1Zm27.3 3.9-10-28.9h6.5l9.5 28.9h-6Zm-7.5 12.2v-5.7h4.9c1 0 2-.1 2.9-.4a4 4 0 0 0 2-1.4c.4-.7.9-1.6 1.2-2.7l8.6-30.9h6.2l-9.3 32.4a14 14 0 0 1-2.5 5 8.9 8.9 0 0 1-4 2.8c-1.5.6-3.4.9-5.6.9h-4.4Zm9-12.2v-5.2h6.4v5.2H248Z"
18
18
  />
19
19
  <path
@@ -23,92 +23,7 @@ const defaultProps = {
23
23
  attribute: 'brand',
24
24
  };
25
25
 
26
- it('accepts an attribute prop', () => {
27
- __setState({
28
- ...defaultState,
29
- });
30
-
31
- const props = {
32
- ...defaultProps,
33
- };
34
-
35
- const wrapper = mount(MenuSelect, {
36
- propsData: props,
37
- });
38
-
39
- expect(wrapper.vm.widgetParams.attribute).toBe('brand');
40
- });
41
-
42
- it('accepts a limit prop', () => {
43
- __setState({
44
- ...defaultState,
45
- });
46
-
47
- const props = {
48
- ...defaultProps,
49
- limit: 5,
50
- };
51
-
52
- const wrapper = mount(MenuSelect, {
53
- propsData: props,
54
- });
55
-
56
- expect(wrapper.vm.widgetParams.limit).toBe(5);
57
- });
58
-
59
- it('accepts a sortBy prop', () => {
60
- __setState({
61
- ...defaultState,
62
- });
63
-
64
- const props = {
65
- ...defaultProps,
66
- sortBy: ['name:desc'],
67
- };
68
-
69
- const wrapper = mount(MenuSelect, {
70
- propsData: props,
71
- });
72
-
73
- expect(wrapper.vm.widgetParams.sortBy).toEqual(['name:desc']);
74
- });
75
-
76
- it('accepts a transformItems prop', () => {
77
- __setState({
78
- ...defaultState,
79
- });
80
-
81
- const transformItems = () => {};
82
-
83
- const props = {
84
- ...defaultProps,
85
- transformItems,
86
- };
87
-
88
- const wrapper = mount(MenuSelect, {
89
- propsData: props,
90
- });
91
-
92
- expect(wrapper.vm.widgetParams.transformItems).toBe(transformItems);
93
- });
94
-
95
26
  describe('default render', () => {
96
- it('renders correctly', () => {
97
- __setState({
98
- ...defaultState,
99
- });
100
-
101
- const props = {
102
- ...defaultProps,
103
- };
104
-
105
- const wrapper = mount(MenuSelect, {
106
- propsData: props,
107
- });
108
-
109
- expect(wrapper.html()).toMatchSnapshot();
110
- });
111
-
112
27
  it('renders correctly with custom label', () => {
113
28
  __setState({
114
29
  ...defaultState,
@@ -129,81 +44,6 @@ describe('default render', () => {
129
44
  expect(wrapper.find('option').html()).toContain('None');
130
45
  expect(wrapper.html()).toMatchSnapshot();
131
46
  });
132
-
133
- it('renders correctly with a selected value', () => {
134
- __setState({
135
- ...defaultState,
136
- items: [
137
- { label: 'Apple', value: 'Apple', isRefined: false, count: 50 },
138
- { label: 'Samsung', value: 'Samsung', isRefined: true, count: 20 },
139
- { label: 'Sony', value: 'Sony', isRefined: false, count: 15 },
140
- ],
141
- });
142
-
143
- const props = {
144
- ...defaultProps,
145
- };
146
-
147
- const wrapper = mount(MenuSelect, {
148
- propsData: props,
149
- });
150
-
151
- const selected = wrapper.find('[value="Samsung"]');
152
- const options = wrapper.findAll('option:not([value="Samsung"])');
153
-
154
- expect(selected.element.selected).toBe(true);
155
-
156
- for (let i = 0; i < options.length; i++) {
157
- expect((options[i] || options.at(i)).element.selected).toBe(false);
158
- }
159
- });
160
-
161
- it('renders correctly without refinements', () => {
162
- __setState({
163
- ...defaultState,
164
- canRefine: false,
165
- items: [],
166
- });
167
-
168
- const props = {
169
- ...defaultProps,
170
- };
171
-
172
- const wrapper = mount(MenuSelect, {
173
- propsData: props,
174
- });
175
-
176
- expect(wrapper.html()).toMatchSnapshot();
177
- });
178
-
179
- it('calls refine on select change', async () => {
180
- const refine = jest.fn();
181
-
182
- __setState({
183
- ...defaultState,
184
- refine,
185
- });
186
-
187
- const props = {
188
- ...defaultProps,
189
- };
190
-
191
- const wrapper = mount(MenuSelect, {
192
- propsData: props,
193
- });
194
-
195
- expect(refine).not.toHaveBeenCalled();
196
-
197
- const select = wrapper.find('select');
198
-
199
- // Simulate the change
200
- select.element.value = 'Apple';
201
-
202
- await select.trigger('change');
203
-
204
- expect(refine).toHaveBeenCalledTimes(1);
205
- expect(refine).toHaveBeenCalledWith('Apple');
206
- });
207
47
  });
208
48
 
209
49
  it('exposes send-event method for insights middleware', async () => {
@@ -62,33 +62,6 @@ exports[`custom item slot renders correctly 1`] = `
62
62
  </div>
63
63
  `;
64
64
 
65
- exports[`default render renders correctly 1`] = `
66
- <div class="ais-MenuSelect">
67
- <select class="ais-MenuSelect-select">
68
- <option class="ais-MenuSelect-option"
69
- value
70
- >
71
- See all
72
- </option>
73
- <option class="ais-MenuSelect-option"
74
- value="Apple"
75
- >
76
- Apple (50)
77
- </option>
78
- <option class="ais-MenuSelect-option"
79
- value="Samsung"
80
- >
81
- Samsung (20)
82
- </option>
83
- <option class="ais-MenuSelect-option"
84
- value="Sony"
85
- >
86
- Sony (15)
87
- </option>
88
- </select>
89
- </div>
90
- `;
91
-
92
65
  exports[`default render renders correctly with custom label 1`] = `
93
66
  <div class="ais-MenuSelect">
94
67
  <select class="ais-MenuSelect-select">
@@ -117,15 +90,3 @@ exports[`default render renders correctly with custom label 1`] = `
117
90
  </select>
118
91
  </div>
119
92
  `;
120
-
121
- exports[`default render renders correctly without refinements 1`] = `
122
- <div class="ais-MenuSelect ais-MenuSelect--noRefinement">
123
- <select class="ais-MenuSelect-select">
124
- <option class="ais-MenuSelect-option"
125
- value
126
- >
127
- See all
128
- </option>
129
- </select>
130
- </div>
131
- `;