Bug Tracker

Opened 14 years ago

Closed 14 years ago

#3361 closed bug (fixed)

qunit: Changes to not require pre-existing DOM elements

Reported by: sugendran Owned by: joern
Priority: minor Milestone: 1.3
Component: qunit Version: 1.2.6
Keywords: qunit Cc:
Blocked by: Blocking:


I don't think qunit should require DOM elements to pre-exisiting (i.e. changes to a site's actual HTML should not have to happen in order to test the functionality)

--- my changes to the runTest() function ---

function runTest() {

_config.blocking = false; var started = +new Date; _config.fixture = (document.getElementById('main') ? document.getElementById('main').innerHTML : ""); _config.ajaxSettings = jQuery.ajaxSettings; if(!document.getElementById("tests")){

$("body").append('<div id="tests"></div>');


synchronize(function() {

jQuery('<p id="testresult" class="result">').html(['Tests completed in ',

+new Date - started, ' milliseconds.<br/>', '<span class="bad">', _config.stats.bad, '</span> tests of <span class="all">', _config.stats.all, '</span> failed.</p>'] .join()) .appendTo("body");

jQuery("#banner").addClass(_config.stats.bad ? "fail" : "pass");



Change History (1)

comment:1 Changed 14 years ago by joern

Resolution: fixed
Status: newclosed

QUnit now requires only the fixture element #main to be present, everything else is generated.

Note: See TracTickets for help on using tickets.