mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-22 04:43:42 +02:00
New test: click nav
This commit is contained in:
26
test/utils/click-nav.test.js
Normal file
26
test/utils/click-nav.test.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import DOM from '../../src/js/utils/dom';
|
||||||
|
import ClickNav from '../../src/js/plugins/click-nav';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
document.body.innerHTML = `<div id="webslides" data-test="test"><p>Text</p></div>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
test('AutoSlide plugin', () => {
|
||||||
|
const next = jest.fn();
|
||||||
|
const ws = document.getElementById('webslides');
|
||||||
|
// Simulates dataset
|
||||||
|
ws.dataset = {};
|
||||||
|
const webslides = {
|
||||||
|
options: {
|
||||||
|
changeOnClick: true
|
||||||
|
},
|
||||||
|
goNext: next,
|
||||||
|
el: ws
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(next).not.toBeCalled();
|
||||||
|
|
||||||
|
const clicknav = new ClickNav(webslides);
|
||||||
|
DOM.fireEvent(ws, 'click');
|
||||||
|
expect(next.mock.calls.length).toBe(1);
|
||||||
|
});
|
Reference in New Issue
Block a user