mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 08:38:11 +00:00
34 lines
613 B
JavaScript
34 lines
613 B
JavaScript
const root = '../../';
|
|
|
|
jest.useFakeTimers();
|
|
|
|
describe('call-function plugin', function(){
|
|
|
|
beforeEach(function(){
|
|
require(root + 'jspsych.js');
|
|
require(root + 'plugins/jspsych-call-function.js');
|
|
});
|
|
|
|
test('loads correctly', function(){
|
|
expect(typeof window.jsPsych.plugins['call-function']).not.toBe('undefined');
|
|
});
|
|
|
|
test('calls function', function(){
|
|
var myFunc = function() {
|
|
return '<p>I am a function</p>';
|
|
}
|
|
|
|
var trial = {
|
|
type: 'call-function',
|
|
func: myFunc
|
|
}
|
|
|
|
jsPsych.init({
|
|
timeline: [trial]
|
|
});
|
|
|
|
expect(jsPsych.getDisplayElement().innerHTML).toBe("");
|
|
});
|
|
|
|
});
|