-
Notifications
You must be signed in to change notification settings - Fork 19
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
fa74a3e
commit 0bde25c
Showing
7 changed files
with
713 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules/ | ||
node_modules/ | ||
coverage/ |
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,3 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-env'] | ||
} |
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 |
---|---|---|
@@ -1,2 +1,47 @@ | ||
import Button from '../Button/Button' | ||
import Button from '../../Button/Button' | ||
import style from '../../Button/style' | ||
|
||
describe('Button', () => { | ||
it('should render a button element', () => { | ||
const button = Button('icon') | ||
expect(button).toMatchSnapshot() | ||
}) | ||
|
||
it('should call handleMouseDown on mousedown', () => { | ||
const handleMouseDown = jest.fn() | ||
const button = Button('icon', handleMouseDown) | ||
button.onmousedown() | ||
|
||
expect(handleMouseDown).toHaveBeenCalled() | ||
}) | ||
|
||
it('should contain an icon in innerHTML', () => { | ||
const button = Button('icon') | ||
|
||
expect(button.innerHTML).toBe('icon') | ||
}) | ||
|
||
it('should have style', () => { | ||
const button = Button('icon') | ||
|
||
const styledButton = document.createElement('div') | ||
styledButton.style.cssText = style | ||
|
||
expect(button.style.cssText).toEqual(styledButton.style.cssText) | ||
}) | ||
|
||
it('should grow transform scale on mouseover', () => { | ||
const button = Button('icon') | ||
button.onmouseover() | ||
|
||
expect(button.style.transform).toEqual("scale(1.2)") | ||
}) | ||
|
||
it('should return to the initial transform scale on mouseout', () => { | ||
const button = Button('icon') | ||
button.onmouseout() | ||
|
||
expect(button.style.transform).toEqual("scale(1)") | ||
}) | ||
|
||
}) |
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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Button should render a button element 1`] = ` | ||
<div | ||
style="display: inline-block; margin: 7px; cursor: pointer; transition: all .2s ease-in-out;" | ||
> | ||
icon | ||
</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
Oops, something went wrong.