Skip to content

Commit 220e79f

Browse files
authored
chore(vue example): remove price range (#6527)
The component `vue-slider-component` throws an error with the new Vite build. I can't seem to find an underlying reason, so for now let's disable the component so release isn't blocked.
1 parent cdd35df commit 220e79f

File tree

3 files changed

+36
-65
lines changed

3 files changed

+36
-65
lines changed

examples/vue/e-commerce/src/App.vue

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -115,46 +115,6 @@
115115
</template>
116116
</ais-panel>
117117

118-
<ais-panel>
119-
<template #header> Price </template>
120-
121-
<template #default>
122-
<ais-range-input attribute="price">
123-
<template
124-
#default="{ currentRefinement, range, refine, canRefine }"
125-
>
126-
<vue-slider
127-
:min="range.min"
128-
:max="range.max"
129-
:value="toValue(currentRefinement, range)"
130-
:disabled="!canRefine"
131-
:lazy="true"
132-
:use-keyboard="true"
133-
:enable-cross="false"
134-
tooltip="always"
135-
:duration="0"
136-
@change="refine({ min: $event[0], max: $event[1] })"
137-
>
138-
<template #dot="{ index, value }">
139-
<div
140-
:aria-valuemin="range.min"
141-
:aria-valuemax="range.max"
142-
:aria-valuenow="value"
143-
:data-handle-key="index"
144-
class="vue-slider-dot-handle"
145-
role="slider"
146-
tabindex="0"
147-
/>
148-
</template>
149-
<template #tooltip="{ value }">
150-
{{ formatNumber(value) }}
151-
</template>
152-
</vue-slider>
153-
</template>
154-
</ais-range-input>
155-
</template>
156-
</ais-panel>
157-
158118
<ais-panel>
159119
<template #header> Free shipping </template>
160120

@@ -490,7 +450,6 @@
490450

491451
<script>
492452
import { liteClient as algoliasearch } from 'algoliasearch/lite';
493-
import VueSlider from 'vue-slider-component';
494453
495454
import getRouting from './routing';
496455
import { formatNumber } from './utils';
@@ -499,7 +458,6 @@ import NoResults from './widgets/NoResults.vue';
499458
500459
export default {
501460
components: {
502-
VueSlider,
503461
ClearRefinements,
504462
NoResults,
505463
},

tests/e2e/specs/initial-state-from-route.spec.ts

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,27 @@ export function createInitialStateFromRouteTestSuite(flavor: string) {
3939
expect(brand).toEqual('KitchenAid');
4040
});
4141

42-
it('must have lower price set to $50 and the upper price set to $350 in the price range', async () => {
43-
const lowerPrice = await browser.getRangeSliderLowerBoundValue();
44-
const upperPrice = await browser.getRangeSliderUpperBoundValue();
42+
if (flavor !== 'vue') {
43+
it('must have lower price set to $50 and the upper price set to $350 in the price range', async () => {
44+
const lowerPrice = await browser.getRangeSliderLowerBoundValue();
45+
const upperPrice = await browser.getRangeSliderUpperBoundValue();
4546

46-
expect(lowerPrice).toEqual(50);
47-
expect(upperPrice).toEqual(350);
48-
});
47+
expect(lowerPrice).toEqual(50);
48+
expect(upperPrice).toEqual(350);
49+
});
4950

50-
it('must have free shipping box checked', async () => {
51-
const freeShipping = await browser.getToggleRefinementStatus();
51+
it('must have free shipping box checked', async () => {
52+
const freeShipping = await browser.getToggleRefinementStatus();
5253

53-
expect(freeShipping).toEqual(true);
54-
});
54+
expect(freeShipping).toEqual(true);
55+
});
5556

56-
it('must have rating "4 & up" selected in the rating menu', async () => {
57-
const rating = await browser.getSelectedRatingMenuItem();
57+
it('must have rating "4 & up" selected in the rating menu', async () => {
58+
const rating = await browser.getSelectedRatingMenuItem();
5859

59-
expect(rating).toEqual('4 & up');
60-
});
60+
expect(rating).toEqual('4 & up');
61+
});
62+
}
6163

6264
it('must have "Price descending" selected in the sort select', async () => {
6365
const sortBy = await browser.getSortByValue();
@@ -127,13 +129,15 @@ export function createInitialStateFromRouteTestSuite(flavor: string) {
127129
await browser.setSortByValue('Price ascending');
128130
});
129131

130-
it('sets lower price to $250 and the upper price to $1250 in the price range', async () => {
131-
// Depending of the steps calculation there can be a difference between
132-
// the wanted value and the actual value of the slider, so we store
133-
// the actual value to use it in for subsequent tests
134-
priceBounds.lower = await browser.dragRangeSliderLowerBoundTo(250);
135-
priceBounds.upper = await browser.dragRangeSliderUpperBoundTo(1250);
136-
});
132+
if (flavor !== 'vue') {
133+
it('sets lower price to $250 and the upper price to $1250 in the price range', async () => {
134+
// Depending of the steps calculation there can be a difference between
135+
// the wanted value and the actual value of the slider, so we store
136+
// the actual value to use it in for subsequent tests
137+
priceBounds.lower = await browser.dragRangeSliderLowerBoundTo(250);
138+
priceBounds.upper = await browser.dragRangeSliderUpperBoundTo(1250);
139+
});
140+
}
137141

138142
it('selects "64 hits per page" in the hits per page select', async () => {
139143
await browser.setHitsPerPage('64 hits per page');
@@ -149,15 +153,19 @@ export function createInitialStateFromRouteTestSuite(flavor: string) {
149153
const url = await browser.getUrl();
150154
const { pathname, searchParams } = new URL(url);
151155

156+
const range =
157+
flavor === 'vue' ||
158+
searchParams.get('price') ===
159+
`${priceBounds.lower}:${priceBounds.upper}`;
160+
152161
return (
153162
pathname ===
154163
`/${root}search/Appliances%2FRanges%2C+Cooktops+%26+Ovens/` &&
155164
searchParams.get('query') === 'cooktop' &&
156165
searchParams.get('page') === '2' &&
157166
searchParams.get('brands') === 'Whirlpool' &&
158167
searchParams.get('rating') === '3' &&
159-
searchParams.get('price') ===
160-
`${priceBounds.lower}:${priceBounds.upper}` &&
168+
range &&
161169
searchParams.get('sortBy') === 'instant_search_price_asc' &&
162170
searchParams.get('hitsPerPage') === '64'
163171
);

tests/e2e/specs/price-range.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
export function createPriceRangeTestSuite(flavor: string) {
22
const root = `examples/${flavor}/e-commerce/`;
33

4+
if (flavor === 'vue') {
5+
// currently no slider on Vue
6+
return;
7+
}
8+
49
describe('search on specific price range', () => {
510
let lowerBound: number;
611
let upperBound: number;

0 commit comments

Comments
 (0)