test/unit/onload.js in smparkes-envjs-0.0.8 vs test/unit/onload.js in smparkes-envjs-0.0.9
- old
+ new
@@ -12,20 +12,18 @@
// depends on <script> blocks and elements in test/index.html
test("Execution of onload events in top-level document",
function() {
// top-level window-onload works, or test framework wouldn't run.....
- expect(7);
+ expect(10);
var mtch = document.getElementById('pCreatedByBodyOnload').innerHTML.
match(/dynamically-generated paragraph/);
try{ ok(mtch && mtch.length > 0,
"Got confirmation that body-onload handler executed");
}catch(e){print(e);}
-print("here",document);
-
/*
mtch = document.getElementById('pCreatedByIframeOnload').innerHTML.
match(/iframe-onload event handler/);
try{ ok(mtch && mtch.length > 0,
"Got confirmation that iframe-onload handler executed");
@@ -61,26 +59,32 @@
img.src = "html/img2.png";
try{ ok(aCounter == 11,
"img-onload handler executes when img.src assigned");
}catch(e){print(e);}
- mtch = document.getElementById('pCreatedByScriptOnloadA').innerHTML.
- match(/script-onload event handler/);
+ mtch = document.getElementById('pCreatedByScriptA').innerHTML.
+ match(/script event handler/);
try{ ok(mtch && mtch.length > 0,
- "Got confirmation that script-onload handler executed, empty tag");
- }catch(e){print(e);}
+ "Got confirmation that script-onerror handler executed");
+ }catch(e){print(e);}
-/*
- mtch = document.getElementById('pCreatedByScriptOnloadB').innerHTML.
- match(/script-onload event handler/);
+ try{ ok(!document.getElementById('pCreatedByScriptB'),
+ "Got confirmation that script-onload handler did not execute");
+ }catch(e){print(e);}
+
+ mtch = document.getElementById('pCreatedByScriptD').innerHTML.
+ match(/script event handler/);
try{ ok(mtch && mtch.length > 0,
- "Script-onload handler executed, with open/close tag pair");
+ "Got confirmation that script-onload handler executed");
}catch(e){print(e);}
-*/
+ try{ ok(!document.getElementById('pCreatedByScriptC'),
+ "Got confirmation that script-onerror handler did not execute");
+ }catch(e){print(e);}
+
mtch = document.getElementById('pShouldntBeCreated');
try{ ok(!(mtch),
-"Confirmed that script-onload handler that shouldn't execute actually didn't");
+ "Confirmed that script-onload handler that shouldn't execute actually didn't");
}catch(e){print(e);}
});
// still to test: onload events for: <frame>, <frameset>, image obj, layer obj