-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test coverage for EuiAvatar. (#184)
- Loading branch information
Showing
3 changed files
with
146 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiAvatar is rendered 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="euiAvatar euiAvatar--m testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`EuiAvatar props imageUrl is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar euiAvatar--m" | ||
style="background-image:url(image url);background-color:#FEB6DB" | ||
/> | ||
`; | ||
|
||
exports[`EuiAvatar props size l is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar euiAvatar--l" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`EuiAvatar props size m is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar euiAvatar--m" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`EuiAvatar props size none is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`EuiAvatar props size s is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar euiAvatar--s" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`EuiAvatar props size xl is rendered 1`] = ` | ||
<div | ||
aria-label="name" | ||
class="euiAvatar euiAvatar--xl" | ||
style="background-image:none;background-color:#FEB6DB" | ||
> | ||
<span | ||
aria-hidden="true" | ||
> | ||
n | ||
</span> | ||
</div> | ||
`; |
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,51 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
import { requiredProps } from '../../test/required_props'; | ||
|
||
import { EuiAvatar, SIZES } from './avatar'; | ||
|
||
describe('EuiAvatar', () => { | ||
test('is rendered', () => { | ||
const component = render( | ||
<EuiAvatar | ||
name="name" | ||
{...requiredProps} | ||
/> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
|
||
describe('props', () => { | ||
describe('imageUrl', () => { | ||
it('is rendered', () => { | ||
const component = render( | ||
<EuiAvatar | ||
name="name" | ||
imageUrl="image url" | ||
/> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('size', () => { | ||
SIZES.forEach(size => { | ||
it(`${size} is rendered`, () => { | ||
const component = render( | ||
<EuiAvatar | ||
name="name" | ||
size={size} | ||
/> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |