Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

load qUnit asynchronously

I am trying to load QUnit in js but the addevent function in QUnit.js is never fired, and it's just not working:

var appendQUnit = document.createElement('script'); 
appendQUnit.src = 'js/utility/qunit/qunit.js';
appendQUnit.type = 'text/javascript'; 
document.getElementsByTagName('head')[0].appendChild(appendQUnit); 
like image 322
The Orca Avatar asked May 09 '26 02:05

The Orca


1 Answers

You might need also to call QUnit.load() in order to initialize QUnit:

$.getScript('js/utility/qunit/qunit.js', function(){
QUnit.load();
// here you can handle the qunit code
});
like image 105
evpozdniakov Avatar answered May 11 '26 15:05

evpozdniakov