mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
adds a test for #990
This commit is contained in:
parent
56a74ac745
commit
b8ad672fb7
@ -27,4 +27,32 @@ describe('nested defaults', function(){
|
||||
expect(display.querySelector('input').placeholder).toBe("")
|
||||
expect(display.querySelector('input').size).toBe(40)
|
||||
});
|
||||
|
||||
test('safe against extending the array.prototype (issue #989)', function(){
|
||||
Array.prototype.qq = jest.fn();
|
||||
const spy = jest.spyOn(console, 'error').mockImplementation();
|
||||
|
||||
var t = {
|
||||
type: 'survey-text',
|
||||
questions: [
|
||||
{
|
||||
prompt: 'Question 1.'
|
||||
},
|
||||
{
|
||||
prompt: 'Question 2.'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
jsPsych.init({timeline: [t]})
|
||||
|
||||
var display = jsPsych.getDisplayElement();
|
||||
|
||||
expect(display.querySelector('input').placeholder).toBe("")
|
||||
expect(display.querySelector('input').size).toBe(40)
|
||||
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
|
||||
spy.mockRestore();
|
||||
});
|
||||
})
|
Loading…
Reference in New Issue
Block a user