forked from mui/base-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f95c8a8
commit 9f47533
Showing
16 changed files
with
1,470 additions
and
26 deletions.
There are no files selected for viewing
1,199 changes: 1,199 additions & 0 deletions
1,199
packages/mui-base/src/Slider2/Root/SliderRoot.test.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/mui-base/src/Slider2/SliderOutput/SliderOutput.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as React from 'react'; | ||
import { createRenderer } from '@mui/internal-test-utils'; | ||
import * as Slider from '@base_ui/react/Slider2'; | ||
import { SliderProvider, type SliderProviderValue } from '@base_ui/react/Slider2'; | ||
import { describeConformance } from '../../../test/describeConformance'; | ||
|
||
const NOOP = () => {}; | ||
|
||
describe('<Slider.Output />', () => { | ||
const { render } = createRenderer(); | ||
|
||
const testProviderValue: SliderProviderValue = { | ||
active: -1, | ||
axis: 'horizontal', | ||
changeValue: NOOP, | ||
compoundComponentContextValue: { | ||
registerItem: () => ({ id: 0, deregister: () => {} }), | ||
getItemIndex: () => 0, | ||
totalSubitemCount: 1, | ||
}, | ||
dragging: false, | ||
disabled: false, | ||
getFingerNewValue: () => ({ | ||
newValue: 0, | ||
activeIndex: 0, | ||
newValuePercent: 0, | ||
}), | ||
handleValueChange: NOOP, | ||
isRtl: false, | ||
largeStep: 10, | ||
max: 100, | ||
min: 0, | ||
open: -1, | ||
orientation: 'horizontal', | ||
ownerState: { | ||
disabled: false, | ||
min: 0, | ||
max: 100, | ||
value: 0, | ||
}, | ||
scale: (val) => val, | ||
setActive: NOOP, | ||
setDragging: NOOP, | ||
setOpen: NOOP, | ||
setValueState: NOOP, | ||
subitems: new Map(), | ||
valueState: 0, | ||
value: [0], | ||
}; | ||
|
||
describeConformance(<Slider.Output />, () => ({ | ||
inheritComponent: 'output', | ||
render: (node) => { | ||
const { container, ...other } = render( | ||
<SliderProvider value={testProviderValue}>{node}</SliderProvider>, | ||
); | ||
|
||
return { container, ...other }; | ||
}, | ||
refInstanceof: window.HTMLOutputElement, | ||
skip: [ | ||
'reactTestRenderer', // Need to be wrapped with SliderProvider | ||
], | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
packages/mui-base/src/Slider2/SliderThumb/SliderThumb.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import * as React from 'react'; | ||
import { createRenderer } from '@mui/internal-test-utils'; | ||
import * as Slider from '@base_ui/react/Slider2'; | ||
import { SliderProvider, type SliderProviderValue } from '@base_ui/react/Slider2'; | ||
import { describeConformance } from '../../../test/describeConformance'; | ||
|
||
const NOOP = () => {}; | ||
|
||
describe('<Slider.Thumb />', () => { | ||
const { render } = createRenderer(); | ||
|
||
const testProviderValue: SliderProviderValue = { | ||
active: -1, | ||
axis: 'horizontal', | ||
changeValue: NOOP, | ||
compoundComponentContextValue: { | ||
registerItem: () => ({ id: 0, deregister: () => {} }), | ||
getItemIndex: () => 0, | ||
totalSubitemCount: 1, | ||
}, | ||
dragging: false, | ||
disabled: false, | ||
getFingerNewValue: () => ({ | ||
newValue: 0, | ||
activeIndex: 0, | ||
newValuePercent: 0, | ||
}), | ||
handleValueChange: NOOP, | ||
isRtl: false, | ||
largeStep: 10, | ||
max: 100, | ||
min: 0, | ||
open: -1, | ||
orientation: 'horizontal', | ||
ownerState: { | ||
disabled: false, | ||
min: 0, | ||
max: 100, | ||
value: 0, | ||
}, | ||
scale: (val) => val, | ||
setActive: NOOP, | ||
setDragging: NOOP, | ||
setOpen: NOOP, | ||
setValueState: NOOP, | ||
subitems: new Map(), | ||
valueState: 0, | ||
value: [0], | ||
}; | ||
|
||
describeConformance(<Slider.Thumb />, () => ({ | ||
inheritComponent: 'span', | ||
render: (node) => { | ||
const { container, ...other } = render( | ||
<SliderProvider value={testProviderValue}>{node}</SliderProvider>, | ||
); | ||
|
||
return { container, ...other }; | ||
}, | ||
refInstanceof: window.HTMLSpanElement, | ||
skip: [ | ||
'reactTestRenderer', // Need to be wrapped with SliderProvider | ||
'propsSpread', // TODO: fix after relocating the <input/> | ||
'renderProp', // TODO: fix after relocating the <input/> | ||
], | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/mui-base/src/Slider2/SliderTrack/SliderTrack.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as React from 'react'; | ||
import { createRenderer } from '@mui/internal-test-utils'; | ||
import * as Slider from '@base_ui/react/Slider2'; | ||
import { SliderProvider, type SliderProviderValue } from '@base_ui/react/Slider2'; | ||
import { describeConformance } from '../../../test/describeConformance'; | ||
|
||
const NOOP = () => {}; | ||
|
||
describe('<Slider.Track />', () => { | ||
const { render } = createRenderer(); | ||
|
||
const testProviderValue: SliderProviderValue = { | ||
active: -1, | ||
axis: 'horizontal', | ||
changeValue: NOOP, | ||
compoundComponentContextValue: { | ||
registerItem: () => ({ id: 0, deregister: () => {} }), | ||
getItemIndex: () => 0, | ||
totalSubitemCount: 1, | ||
}, | ||
dragging: false, | ||
disabled: false, | ||
getFingerNewValue: () => ({ | ||
newValue: 0, | ||
activeIndex: 0, | ||
newValuePercent: 0, | ||
}), | ||
handleValueChange: NOOP, | ||
isRtl: false, | ||
largeStep: 10, | ||
max: 100, | ||
min: 0, | ||
open: -1, | ||
orientation: 'horizontal', | ||
ownerState: { | ||
disabled: false, | ||
min: 0, | ||
max: 100, | ||
value: 0, | ||
}, | ||
scale: (val) => val, | ||
setActive: NOOP, | ||
setDragging: NOOP, | ||
setOpen: NOOP, | ||
setValueState: NOOP, | ||
subitems: new Map(), | ||
valueState: 0, | ||
value: [0], | ||
}; | ||
|
||
describeConformance(<Slider.Track />, () => ({ | ||
inheritComponent: 'span', | ||
render: (node) => { | ||
const { container, ...other } = render( | ||
<SliderProvider value={testProviderValue}>{node}</SliderProvider>, | ||
); | ||
|
||
return { container, ...other }; | ||
}, | ||
refInstanceof: window.HTMLSpanElement, | ||
skip: [ | ||
'reactTestRenderer', // Need to be wrapped with SliderProvider | ||
], | ||
})); | ||
}); |
Oops, something went wrong.