-
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.
- Loading branch information
Showing
31 changed files
with
972 additions
and
118 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
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
31 changes: 30 additions & 1 deletion
31
eventol/front/src/components/ItemMap/__snapshots__/index.test.jsx.snap
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,3 +1,32 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ItemMap Default Snapshot 1`] = `undefined`; | ||
exports[`ItemMap Default Snapshot 1`] = ` | ||
<div | ||
className="item max-size" | ||
id="1event1slug" | ||
> | ||
<a | ||
href="event1Url" | ||
> | ||
<div | ||
className="overlay" | ||
> | ||
<div | ||
className="title" | ||
> | ||
event 1 | ||
</div> | ||
<div | ||
className="rating" | ||
> | ||
Attendees: 10 | ||
</div> | ||
<div | ||
className="plot" | ||
> | ||
event1overview | ||
</div> | ||
</div> | ||
</a> | ||
</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
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
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
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,27 +1,66 @@ | ||
import wait from 'waait'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import Search from '.'; | ||
|
||
describe('Search', () => { | ||
let component; | ||
let instance; | ||
let tree; | ||
let onEnter; | ||
let element; | ||
let onChange; | ||
let instance; | ||
let component; | ||
|
||
const getComponent = () => { | ||
component = renderer.create(<Search />); | ||
element = <Search onChange={onChange} onEnter={onEnter} />; | ||
component = renderer.create(element); | ||
return component; | ||
}; | ||
|
||
beforeEach(() => { | ||
onChange = jest.fn(); | ||
onEnter = jest.fn(); | ||
component = getComponent(); | ||
instance = renderer.root; | ||
instance = component.root; | ||
tree = component.toJSON(); | ||
}); | ||
|
||
describe('Default', () => { | ||
test('Snapshot', () => { | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('Snapshot with update text', async () => { | ||
expect(tree).toMatchSnapshot(); | ||
|
||
const value = 'searchTerm'; | ||
instance.findByType('input').props.onChange({target: {value}}); | ||
component.update(element); | ||
await wait(0); | ||
|
||
tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
expect(instance.findByType('input').props.value).toEqual(value); | ||
}); | ||
}); | ||
|
||
test('handle onChange', () => { | ||
const value = 'searchTerm'; | ||
instance.findByType('input').props.onChange({target: {value}}); | ||
expect(onChange).toBeCalled(); | ||
expect(onChange).toBeCalledWith(value); | ||
}); | ||
|
||
describe('handle onKeyUp', () => { | ||
test('With not Enter key', () => { | ||
instance.findByType('input').props.onKeyUp({key: 'A'}); | ||
expect(onEnter).not.toBeCalled(); | ||
}); | ||
|
||
test('With Enter key', () => { | ||
instance.findByType('input').props.onKeyUp({key: 'Enter'}); | ||
expect(onEnter).toBeCalled(); | ||
}); | ||
}); | ||
}); |
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.