-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add error Tag and SelectList variants (#372)
* fix: add Open Sans font to storybook * feat: add variants of tag component in Tag and SelectList (#354) * feat: add variants of tag component, resolve comments --------- Co-authored-by: Yurii Pavlovskyi <yurii.pavlovskyi@free-now.com>
- Loading branch information
Showing
7 changed files
with
307 additions
and
40 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,62 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import * as React from 'react'; | ||
import { SelectList } from './SelectList'; | ||
import { SemanticColors } from '../../essentials'; | ||
|
||
describe('SelectList', () => { | ||
it('renders options in multi select', () => { | ||
const options = [ | ||
{ | ||
label: 'Sales', | ||
value: 'sales' | ||
}, | ||
{ | ||
label: 'Marketing', | ||
value: 'marketing', | ||
error: true | ||
} | ||
]; | ||
|
||
render(<SelectList options={options} value={options} isMulti />); | ||
|
||
const normalTag = screen.getByText('Sales').parentElement; | ||
expect(normalTag).toHaveStyle(` | ||
background-color: ${SemanticColors.background.info}; | ||
border-color: ${SemanticColors.border.infoEmphasized}; | ||
`); | ||
|
||
const errorTag = screen.getByText('Marketing').parentElement; | ||
expect(errorTag).toHaveStyle(` | ||
background-color: transparent; | ||
border-color: ${SemanticColors.border.dangerEmphasized}; | ||
`); | ||
}); | ||
|
||
it('disables options in multi select when control is disabled', () => { | ||
const options = [ | ||
{ | ||
label: 'Sales', | ||
value: 'sales' | ||
}, | ||
{ | ||
label: 'Marketing', | ||
value: 'marketing', | ||
error: true | ||
} | ||
]; | ||
|
||
render(<SelectList options={options} value={options} isMulti isDisabled />); | ||
|
||
const normalTag = screen.getByText('Sales').parentElement; | ||
expect(normalTag).toHaveStyle(` | ||
background-color: transparent; | ||
border-color: ${SemanticColors.border.primary}; | ||
`); | ||
|
||
const errorTag = screen.getByText('Marketing').parentElement; | ||
expect(errorTag).toHaveStyle(` | ||
background-color: transparent; | ||
border-color: ${SemanticColors.border.primary}; | ||
`); | ||
}); | ||
}); |
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
Oops, something went wrong.