Skip to content

Commit

Permalink
test(Slider): fix TS
Browse files Browse the repository at this point in the history
  • Loading branch information
itwillwork committed Dec 27, 2024
1 parent 399b121 commit 2d0959b
Show file tree
Hide file tree
Showing 58 changed files with 14 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
15 changes: 9 additions & 6 deletions src/components/Slider/__tests__/Slider.visual.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react';
import {test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
import type {SliderProps} from '../Slider';
import {Slider} from '../Slider';
import type {SliderProps} from '../types';

import {
availableValuesCases,
Expand All @@ -17,10 +17,11 @@ import {
} from './cases';

test.describe('Slider', {tag: '@Slider'}, () => {
const defaultProps: SliderProps<number> = {
const defaultProps: SliderProps = {
value: 40,
min: 0,
max: 100,
onUpdate: () => {},
};

createSmokeScenarios(defaultProps, {
Expand All @@ -43,7 +44,7 @@ test.describe('Slider', {tag: '@Slider'}, () => {
});
});

createSmokeScenarios(
createSmokeScenarios<SliderProps>(
{
...defaultProps,
validationState: 'invalid',
Expand All @@ -69,13 +70,14 @@ test.describe('Slider', {tag: '@Slider'}, () => {
});
});

const defaultRangeProps: SliderProps<[number, number]> = {
const defaultRangeProps: SliderProps = {
value: [20, 40],
min: 0,
max: 100,
onUpdate: () => {},
};

createSmokeScenarios(
createSmokeScenarios<SliderProps>(
defaultRangeProps,
{
size: sizeCases,
Expand All @@ -100,7 +102,8 @@ test.describe('Slider', {tag: '@Slider'}, () => {
await expectScreenshot();
});
});
createSmokeScenarios(

createSmokeScenarios<SliderProps>(
{
...defaultRangeProps,
validationState: 'invalid',
Expand Down
8 changes: 5 additions & 3 deletions src/components/Slider/__tests__/cases.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type {Cases} from '../../../stories/tests-factory/models';
import type {SliderProps} from '../Slider';
import type {Cases, CasesWithName} from '../../../stories/tests-factory/models';
import type {SliderProps} from '../types';

export const sizeCases: Cases<SliderProps['size']> = ['s', 'm', 'l', 'xl'];
export const disabledCases: Cases<SliderProps['disabled']> = [true];
export const validationStateCases: Cases<SliderProps['validationState']> = ['invalid'];
export const hasTooltipCases: Cases<SliderProps['hasTooltip']> = [true];
export const marksCountCases: Cases<SliderProps['marksCount']> = [4];
export const stepCases: Cases<SliderProps['step']> = [5];
export const availableValuesCases: Cases<SliderProps['availableValues']> = [10, 20, 50, 55, 65, 80];
export const availableValuesCases: CasesWithName<SliderProps['availableValues']> = [
['10-20-50-55-65-80', [10, 20, 50, 55, 65, 80]],
];

0 comments on commit 2d0959b

Please sign in to comment.