Skip to content

Commit

Permalink
Bump deps, add arrow key tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Jul 12, 2019
1 parent 055e457 commit bf8300f
Show file tree
Hide file tree
Showing 4 changed files with 382 additions and 262 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,38 @@
"tippy.js": "^5.0.0-alpha.2"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/core": "^7.5.4",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/preset-env": "^7.4.5",
"autoprefixer": "^9.6.0",
"@babel/preset-env": "^7.5.4",
"@testing-library/jest-dom": "^4.0.0",
"autoprefixer": "^9.6.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.7.1",
"babel-plugin-rewire-exports": "^1.2.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"chai": "^4.2.0",
"codeclimate-test-reporter": "^0.5.1",
"cssnano": "^4.1.10",
"cypress": "^3.3.2",
"cypress": "^3.4.0",
"cypress-plugin-tab": "^1.0.1",
"del": "^5.0.0",
"esdoc": "^1.1.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^6.0.1",
"eslint-plugin-jest": "^22.7.1",
"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-ship-shape": "^0.6.0",
"glob": "^7.1.3",
"http-server": "^0.11.1",
"jest": "^24.8.0",
"jest-dom": "^3.5.0",
"jest-expect-message": "^1.0.2",
"jest-transform-css": "^2.0.0",
"mutationobserver-shim": "^0.3.3",
"postcss": "^7.0.14",
"replace": "^1.1.0",
"rimraf": "^2.6.3",
"rollup": "^1.16.3",
"rollup-plugin-analyzer": "^3.0.1",
"rollup": "^1.16.7",
"rollup-plugin-analyzer": "^3.1.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-browsersync": "^1.0.0",
"rollup-plugin-commonjs": "^10.0.1",
Expand All @@ -97,8 +97,8 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-sass": "^1.2.2",
"rollup-plugin-stylelint": "^0.0.4",
"rollup-plugin-terser": "^5.0.0",
"rollup-plugin-visualizer": "^2.4.3",
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-visualizer": "^2.4.4",
"sinon": "^7.3.2",
"start-server-and-test": "^1.9.1",
"stylelint": "^10.1.0",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import 'jest-expect-message';
import 'jest-dom/extend-expect';
import 'mutationobserver-shim';
import '@testing-library/jest-dom/extend-expect';
import 'mutationobserver-shim';
28 changes: 28 additions & 0 deletions test/unit/step.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,34 @@ describe('Tour | Step', () => {
expect(cancelStub.called).toBe(true);
cancelStub.restore();
});

it('arrow keys move between steps', () => {
const element = document.createElement('div');
const tour = new Tour();
const step = new Step(tour, {});

const tourBackStub = stub(tour, 'back');
const tourNextStub = stub(tour, 'next');

expect(tourBackStub.called).toBe(false);
expect(tourNextStub.called).toBe(false);

step._addKeyDownHandler(element);

const rightArrowEvent = new KeyboardEvent('keydown', { keyCode: 39 });
element.dispatchEvent(rightArrowEvent);

expect(tourNextStub.called).toBe(true);


const leftArrowEvent = new KeyboardEvent('keydown', { keyCode: 37 });
element.dispatchEvent(leftArrowEvent);

expect(tourBackStub.called).toBe(true);

tourBackStub.restore();
tourNextStub.restore();
});
});

describe('_addCancelLink', () => {
Expand Down
Loading

0 comments on commit bf8300f

Please sign in to comment.