From 624be493669c3d45ed267cc0ca4843e4f265d275 Mon Sep 17 00:00:00 2001 From: Sean Poulter Date: Sun, 15 Apr 2018 22:37:11 -0400 Subject: [PATCH] Fix failing tests caused by timing issues --- test/input-panel.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/input-panel.test.js b/test/input-panel.test.js index 430bb86..fda4f2a 100644 --- a/test/input-panel.test.js +++ b/test/input-panel.test.js @@ -2,14 +2,17 @@ import assert from 'assert'; import jsdom from 'jsdom'; import R from 'ramda'; import sinon from 'sinon'; -import bindInputPanel from '../lib/js/input-panel'; + +// Provide a way to push time forwards (as the input is debounced). +const clock = sinon.useFakeTimers(); +const bindInputPanel = require('../lib/js/input-panel').default; + describe('Input panel', function() { let errMsgEl, inputEl, - output, - clock; + output; beforeEach(function() { @@ -35,9 +38,6 @@ describe('Input panel', function() { // https://github.com/tmpvar/jsdom/issues/317 doc.body.createTextRange = () => doc.querySelector('.mock'); - // Provide a way to push time forwards (as the input is debounced). - clock = sinon.useFakeTimers(); - errMsgEl = doc.querySelector('.err-msg'); inputEl = doc.querySelector('.input'); output = {