From 2a900c7d3e74323cb98f8fb8fc6658f76c2bc610 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Thu, 25 May 2017 10:39:29 -0400 Subject: [PATCH] add fullscreen partial test --- tests/plugins/plugin-fullscreen.test.js | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/plugins/plugin-fullscreen.test.js diff --git a/tests/plugins/plugin-fullscreen.test.js b/tests/plugins/plugin-fullscreen.test.js new file mode 100644 index 00000000..8a725ccb --- /dev/null +++ b/tests/plugins/plugin-fullscreen.test.js @@ -0,0 +1,41 @@ +const root = '../../'; + +jest.useFakeTimers(); + +describe('fullscreen plugin', function(){ + + beforeEach(function(){ + require(root + 'jspsych.js'); + require(root + 'plugins/jspsych-fullscreen.js'); + require(root + 'plugins/jspsych-text.js'); + }); + + test('loads correctly', function(){ + expect(typeof window.jsPsych.plugins['fullscreen']).not.toBe('undefined'); + }); + + // can't test this right now because jsdom doesn't support fullscreen API. + + /*test('launches fullscreen mode by default', function(){ + var trial = { + type: 'fullscreen', + delay_after: 0 + } + + var text = { + type: 'text', + text: 'fullscreen' + } + + jsPsych.init({ + timeline: [trial, text] + }); + + expect(document.fullscreenElement).toBeUndefined(); + console.log(jsPsych.getDisplayElement().requestFullscreen); + document.querySelector('#jspsych-fullscreen-btn').dispatchEvent(new MouseEvent('click', {})); + + expect(document.fullscreenElement).not.toBeUndefined(); + });*/ + +});