This repository has been archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Highlight): Fix undefined class assigned to element (#572)
Due to the `[styles[tone]]: true` defaulting tone to `TONE.NEUTRAL`, by default we always get `undefined` class being assigned to the element. This is caused by the fact that `.neutral` class does not exist in the stylesheet. Tone is NOT a required prop from the consumer's perspective and also defaulting is a) doing nothing, b) introducing incorrect behaviour of the component.
- Loading branch information
Showing
4 changed files
with
59 additions
and
4 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
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,22 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import Highlight from './Highlight'; | ||
|
||
describe('Highlight:', () => { | ||
it('should render with defaults', () => { | ||
expect(shallow(<Highlight>text</Highlight>)).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render with className', () => { | ||
expect(shallow(<Highlight className="foo">text</Highlight>)).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render with tone', () => { | ||
expect(shallow(<Highlight tone="critical" className="foo">text</Highlight>)).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render as secondary', () => { | ||
expect(shallow(<Highlight secondary tone="critical" className="foo">text</Highlight>)).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Highlight: should render as secondary 1`] = ` | ||
<mark | ||
className="Highlight__root Highlight__secondaryText Highlight__critical foo" | ||
> | ||
text | ||
</mark> | ||
`; | ||
|
||
exports[`Highlight: should render with className 1`] = ` | ||
<mark | ||
className="Highlight__root foo" | ||
> | ||
text | ||
</mark> | ||
`; | ||
|
||
exports[`Highlight: should render with defaults 1`] = ` | ||
<mark | ||
className="Highlight__root" | ||
> | ||
text | ||
</mark> | ||
`; | ||
|
||
exports[`Highlight: should render with tone 1`] = ` | ||
<mark | ||
className="Highlight__root Highlight__critical foo" | ||
> | ||
text | ||
</mark> | ||
`; |