forked from akiran/react-slick
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0f6e28e
commit 6de2312
Showing
2 changed files
with
131 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import { html as beautify_html } from 'js-beautify' | ||
import { clickNext } from '../../__tests__/testUtils' | ||
import FocusOnSelect from '../FocusOnSelect' | ||
|
||
describe('FocusOnSelect Tests', () => { | ||
test('Activity Test', () => { | ||
const slider = mount(<FocusOnSelect />) | ||
expect(slider.find('div.slick-current').props()['data-index']).toEqual(0) | ||
expect(beautify_html(slider.html())).toMatchSnapshot() | ||
slider.find('[data-index=2]').simulate('click') | ||
expect(slider.find('div.slick-current').props()['data-index']).toEqual(2) | ||
expect(beautify_html(slider.html())).toMatchSnapshot() | ||
}) | ||
}) |
115 changes: 115 additions & 0 deletions
115
examples/__tests__/__snapshots__/FocusOnSelect.test.js.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 |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`FocusOnSelect Tests Activity Test 1`] = ` | ||
"<div> | ||
<h2>FocusOnSelect</h2> | ||
<div>Click on any slide to select and make it current slide</div> | ||
<div class=\\"slick-initialized slick-slider\\" dir=\\"ltr\\"><button type=\\"button\\" data-role=\\"none\\" class=\\"slick-arrow slick-prev\\" style=\\"display: block;\\"> Previous</button> | ||
<div class=\\"slick-list\\"> | ||
<div class=\\"slick-track\\" style=\\"opacity: 1;\\"> | ||
<div data-index=\\"-3\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"-2\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"-1\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
<div data-index=\\"0\\" class=\\"slick-slide slick-active slick-current\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>1</h3> | ||
</div> | ||
<div data-index=\\"1\\" class=\\"slick-slide slick-active\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>2</h3> | ||
</div> | ||
<div data-index=\\"2\\" class=\\"slick-slide slick-active\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>3</h3> | ||
</div> | ||
<div data-index=\\"3\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"4\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"5\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
<div data-index=\\"6\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>1</h3> | ||
</div> | ||
<div data-index=\\"7\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>2</h3> | ||
</div> | ||
<div data-index=\\"8\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>3</h3> | ||
</div> | ||
<div data-index=\\"9\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"10\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"11\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
</div> | ||
</div><button type=\\"button\\" data-role=\\"none\\" class=\\"slick-arrow slick-next\\" style=\\"display: block;\\"> Next</button></div> | ||
</div>" | ||
`; | ||
exports[`FocusOnSelect Tests Activity Test 2`] = ` | ||
"<div> | ||
<h2>FocusOnSelect</h2> | ||
<div>Click on any slide to select and make it current slide</div> | ||
<div class=\\"slick-initialized slick-slider\\" dir=\\"ltr\\"><button type=\\"button\\" data-role=\\"none\\" class=\\"slick-arrow slick-prev\\" style=\\"display: block;\\"> Previous</button> | ||
<div class=\\"slick-list\\"> | ||
<div class=\\"slick-track\\" style=\\"opacity: 1;\\"> | ||
<div data-index=\\"-3\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"-2\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"-1\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
<div data-index=\\"0\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>1</h3> | ||
</div> | ||
<div data-index=\\"1\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>2</h3> | ||
</div> | ||
<div data-index=\\"2\\" class=\\"slick-slide slick-active slick-current\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>3</h3> | ||
</div> | ||
<div data-index=\\"3\\" class=\\"slick-slide slick-active\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"4\\" class=\\"slick-slide slick-active\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"5\\" class=\\"slick-slide\\" tabindex=\\"-1\\" style=\\"outline: none; width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
<div data-index=\\"6\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>1</h3> | ||
</div> | ||
<div data-index=\\"7\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>2</h3> | ||
</div> | ||
<div data-index=\\"8\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>3</h3> | ||
</div> | ||
<div data-index=\\"9\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>4</h3> | ||
</div> | ||
<div data-index=\\"10\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>5</h3> | ||
</div> | ||
<div data-index=\\"11\\" tabindex=\\"-1\\" class=\\"slick-slide slick-cloned\\" style=\\"width: 0px;\\"> | ||
<h3>6</h3> | ||
</div> | ||
</div> | ||
</div><button type=\\"button\\" data-role=\\"none\\" class=\\"slick-arrow slick-next\\" style=\\"display: block;\\"> Next</button></div> | ||
</div>" | ||
`; |