-
Notifications
You must be signed in to change notification settings - Fork 1
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
c501a7a
commit dcab2cb
Showing
4 changed files
with
146 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import Select from './Select'; | ||
|
||
describe('Select', () => { | ||
const defaultSelectProps: ComponentProps<typeof Select> = { | ||
options: [ | ||
{ label: 'Option 1', value: '1' }, | ||
{ label: 'Option 2', value: '2' }, | ||
], | ||
}; | ||
|
||
test('default snapshot', () => { | ||
const component = <Select {...defaultSelectProps} />; | ||
const { asFragment } = render(component); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
test('select with default value', () => { | ||
const component = ( | ||
<Select {...defaultSelectProps} defaultValue={defaultSelectProps.options[0]} /> | ||
); | ||
const { asFragment } = render(component); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
}); |
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
109 changes: 109 additions & 0 deletions
109
src/components/Select/__snapshots__/Select.test.tsx.snap
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,109 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Select default snapshot 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="ventura select css-2b097c-container" | ||
> | ||
<span | ||
aria-atomic="false" | ||
aria-live="polite" | ||
aria-relevant="additions text" | ||
class="css-1f43avz-a11yText-A11yText" | ||
/> | ||
<div | ||
class="ventura-select__control css-yk16xz-control" | ||
> | ||
<div | ||
class="ventura-select__value-container css-g1d714-ValueContainer" | ||
> | ||
<div | ||
class="ventura-select__placeholder css-1wa3eu0-placeholder" | ||
/> | ||
<div | ||
class="css-b8ldur-Input" | ||
> | ||
<div | ||
class="ventura-select__input" | ||
style="display: inline-block;" | ||
> | ||
<input | ||
aria-autocomplete="list" | ||
autocapitalize="none" | ||
autocomplete="off" | ||
autocorrect="off" | ||
id="react-select-2-input" | ||
spellcheck="false" | ||
style="box-sizing: content-box; width: 2px; border: 0px; opacity: 1; outline: 0; padding: 0px;" | ||
tabindex="0" | ||
type="text" | ||
value="" | ||
/> | ||
<div | ||
style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-family: -webkit-small-control; letter-spacing: normal; text-transform: none;" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
class="ventura-select__indicators css-1hb7zxy-IndicatorsContainer" | ||
/> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; | ||
|
||
exports[`Select select with default value 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="ventura select css-2b097c-container" | ||
> | ||
<span | ||
aria-atomic="false" | ||
aria-live="polite" | ||
aria-relevant="additions text" | ||
class="css-1f43avz-a11yText-A11yText" | ||
/> | ||
<div | ||
class="ventura-select__control css-yk16xz-control" | ||
> | ||
<div | ||
class="ventura-select__value-container ventura-select__value-container--has-value css-g1d714-ValueContainer" | ||
> | ||
<div | ||
class="ventura-select__single-value css-1uccc91-singleValue" | ||
> | ||
Option 1 | ||
</div> | ||
<div | ||
class="css-b8ldur-Input" | ||
> | ||
<div | ||
class="ventura-select__input" | ||
style="display: inline-block;" | ||
> | ||
<input | ||
aria-autocomplete="list" | ||
autocapitalize="none" | ||
autocomplete="off" | ||
autocorrect="off" | ||
id="react-select-3-input" | ||
spellcheck="false" | ||
style="box-sizing: content-box; width: 2px; border: 0px; opacity: 1; outline: 0; padding: 0px;" | ||
tabindex="0" | ||
type="text" | ||
value="" | ||
/> | ||
<div | ||
style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-family: -webkit-small-control; letter-spacing: normal; text-transform: none;" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
class="ventura-select__indicators css-1hb7zxy-IndicatorsContainer" | ||
/> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; |