diff --git a/src/server/pause.js b/src/server/pause.js index c98f935d..de97a600 100644 --- a/src/server/pause.js +++ b/src/server/pause.js @@ -117,9 +117,11 @@ const controls = ` document.body.insertAdjacentHTML('afterBegin', controls); -document.querySelector('#skip-button').addEventListener('click', skip); document.querySelector('#skip-all-button').addEventListener('click', skipAll); +const skipBtn = document.querySelector('#skip-button'); ++skipBtn.addEventListener('click', skip); + const startBtn = document.querySelector('#start-button'); startBtn.addEventListener('click', start); @@ -132,7 +134,7 @@ runBtn.addEventListener('click', run); const testName = document.querySelector('#test-name'); /* eslint-disable no-undef, no-invalid-this */ -let currentTest; +let currentTest, focusEl = runBtn; beforeEach(async function() { const fixture = new Promise(r => test.update = r); @@ -147,7 +149,7 @@ beforeEach(async function() { if (test.pause) { runBtn.disabled = false; - runBtn.focus(); + focusEl.focus(); } }); }); @@ -160,6 +162,7 @@ function start() { } function run() { + focusEl = runBtn; runBtn.disabled = true; test.run(); } @@ -171,6 +174,7 @@ function runAll() { } function skip() { + focusEl = skipBtn; run(); try { currentTest.skip();