-
-
Notifications
You must be signed in to change notification settings - Fork 927
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added some styles test case. * Update some test case. * Update some test case. * Update some test case. * Update case for Firefox * Update case for Notification&Alert (#575) * Update karma config , only use Chrome in develop. * Update case for Firefox * Update package-lock use registry.npm.org
- Loading branch information
Showing
88 changed files
with
2,402 additions
and
64 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import Alert from '../index'; | ||
import { getStyle, toRGB } from '@test/testUtils'; | ||
|
||
import '../styles/index'; | ||
|
||
describe('Alert styles', () => { | ||
it('Should render the correct background color', () => { | ||
Alert.info('This is a informations.', 0); | ||
const dom = document.body.querySelector('.rs-alert'); | ||
assert.equal( | ||
getStyle(dom.querySelector('.rs-alert-item-content'), 'backgroundColor'), | ||
toRGB('#e9f5fe') | ||
); | ||
}); | ||
}); |
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,30 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Avatar from '../index'; | ||
import { createTestContainer, getDOMNode, getStyle, toRGB, itChrome } from '@test/testUtils'; | ||
|
||
import '../styles/index'; | ||
|
||
describe('Avatar styles', () => { | ||
it('Should render the correct background', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Avatar ref={instanceRef} />, createTestContainer()); | ||
assert.equal(getStyle(getDOMNode(instanceRef.current), 'backgroundColor'), toRGB('#d9d9d9')); | ||
}); | ||
|
||
it('Should apply size class', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Avatar size="lg" ref={instanceRef} />, createTestContainer()); | ||
const dom = getDOMNode(instanceRef.current); | ||
assert.equal(getStyle(dom, 'width'), '60px'); | ||
assert.equal(getStyle(dom, 'width'), getStyle(dom, 'height')); | ||
assert.equal(getStyle(dom, 'font-size'), '26px'); | ||
}); | ||
|
||
// @description Can't get border-radius value in other browser except chrome | ||
itChrome('Should render circle avatar', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Avatar ref={instanceRef} circle />, createTestContainer()); | ||
assert.equal(getStyle(getDOMNode(instanceRef.current), 'borderRadius'), '50%'); | ||
}); | ||
}); |
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,31 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Badge from '../index'; | ||
import { createTestContainer, getDOMNode, getStyle, toRGB, itChrome } from '@test/testUtils'; | ||
|
||
import '../styles/index'; | ||
|
||
describe('Badge styles', () => { | ||
it('Independent should render correct style ', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Badge ref={instanceRef} />, createTestContainer()); | ||
const dom = getDOMNode(instanceRef.current); | ||
assert.equal(getStyle(dom, 'width'), '8px'); | ||
assert.equal(getStyle(dom, 'width'), getStyle(dom, 'height')); | ||
}); | ||
|
||
// @description Can't get border-radius value in other browser except chrome | ||
itChrome('Independent should render correct style ', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Badge ref={instanceRef} />, createTestContainer()); | ||
const dom = getDOMNode(instanceRef.current); | ||
assert.equal(getStyle(dom, 'borderRadius'), '4px'); | ||
}); | ||
|
||
it('Should render correct color', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render(<Badge ref={instanceRef} />, createTestContainer()); | ||
const dom = getDOMNode(instanceRef.current); | ||
assert.equal(getStyle(dom, 'color'), toRGB('#fff')); | ||
}); | ||
}); |
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,37 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Breadcrumb from '../index'; | ||
import { createTestContainer, getDOMNode, getStyle, toRGB } from '@test/testUtils'; | ||
|
||
import '../styles/index'; | ||
|
||
describe('BreadcrumbItem styles', () => { | ||
it('Should render correct styles', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render( | ||
<Breadcrumb ref={instanceRef}> | ||
<Breadcrumb.Item>1</Breadcrumb.Item> | ||
<Breadcrumb.Item>2</Breadcrumb.Item> | ||
</Breadcrumb>, | ||
createTestContainer() | ||
); | ||
const dom = getDOMNode(instanceRef.current); | ||
const li = dom.firstElementChild; | ||
const a = li.querySelector('a'); | ||
assert.equal(getStyle(li, 'fontSize'), '12px'); | ||
assert.equal(getStyle(a, 'cursor'), 'pointer'); | ||
}); | ||
|
||
it('Active item should render correct color', () => { | ||
const instanceRef = React.createRef(); | ||
ReactDOM.render( | ||
<Breadcrumb ref={instanceRef}> | ||
<Breadcrumb.Item active>1</Breadcrumb.Item> | ||
</Breadcrumb>, | ||
createTestContainer() | ||
); | ||
const dom = getDOMNode(instanceRef.current); | ||
const li = dom.firstElementChild; | ||
assert.equal(getStyle(li, 'color'), toRGB('#8e8e93')); | ||
}); | ||
}); |
Oops, something went wrong.