mshtml: Added IHTMLScriptElement::put_text tests.
This commit is contained in:
parent
1aa8742da7
commit
b6bc92aaa9
|
@ -5,6 +5,7 @@ Script execution test
|
|||
<div id="b2"></div>
|
||||
<div id="b3"></div>
|
||||
<script id="emptyscript"></script>
|
||||
<script id="put_text_script">2+2</script>
|
||||
<script>
|
||||
function ok(b, msg) {
|
||||
return external.ok(b, msg);
|
||||
|
@ -12,6 +13,7 @@ function ok(b, msg) {
|
|||
|
||||
var executed = false;
|
||||
var extern_cnt = 0;
|
||||
var exec_cnt;
|
||||
|
||||
function testWriteScript() {
|
||||
var len = document.getElementsByTagName('div').length;
|
||||
|
@ -24,7 +26,7 @@ function testWriteScript() {
|
|||
+ "<" + "/script>");
|
||||
|
||||
len = document.getElementsByTagName('script').length;
|
||||
ok(len === 3, "script col length = " + len);
|
||||
ok(len === 4, "script col length = " + len);
|
||||
ok(executed, "written script not executed");
|
||||
}
|
||||
|
||||
|
@ -36,9 +38,22 @@ function testPutSrc() {
|
|||
ok(extern_cnt === 0, "extern_cnt = " + extern_cnt + " expected 0");
|
||||
}
|
||||
|
||||
function testPutText() {
|
||||
var elem = document.getElementById("put_text_script");
|
||||
|
||||
exec_cnt = 0;
|
||||
elem.text = "exec_cnt++;";
|
||||
ok(exec_cnt === 1, "put_text_script exec_cnt " + exec_cnt);
|
||||
|
||||
exec_cnt = 0;
|
||||
elem.text = "exec_cnt++;";
|
||||
ok(exec_cnt === 1, "put_text_script exec_cnt " + exec_cnt);
|
||||
}
|
||||
|
||||
try {
|
||||
testWriteScript();
|
||||
testPutSrc();
|
||||
testPutText();
|
||||
}catch(e) {
|
||||
ok(false, "Got an exception");
|
||||
}
|
||||
|
@ -67,10 +82,46 @@ function testPutSrc2() {
|
|||
ok(extern_cnt === 4, "extern_cnt = " + extern_cnt + " expected 4");
|
||||
}
|
||||
|
||||
function testPutText2() {
|
||||
var elem;
|
||||
|
||||
elem = document.createElement("script");
|
||||
exec_cnt = 0;
|
||||
elem.text = "exec_cnt++;";
|
||||
ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
|
||||
|
||||
document.body.appendChild(elem);
|
||||
ok(exec_cnt === 1, "script exec_cnt " + exec_cnt);
|
||||
exec_cnt = 0;
|
||||
elem.text = "exec_cnt++;";
|
||||
ok(exec_cnt === 1, "script exec_cnt " + exec_cnt);
|
||||
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 5, "extern_cnt = " + extern_cnt + " expected 5");
|
||||
|
||||
exec_cnt = 0;
|
||||
ok(extern_cnt === 5, "> extern_cnt = " + extern_cnt + " expected 5");
|
||||
elem.text = "exec_cnt++;"; /* forces evaluation, but src will be executed */
|
||||
ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
|
||||
ok(extern_cnt === 6, "< extern_cnt = " + extern_cnt + " expected 6");
|
||||
|
||||
elem = document.createElement("script");
|
||||
exec_cnt = 0;
|
||||
elem.text = "exec_cnt++;";
|
||||
ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 6, "extern_cnt = " + extern_cnt + " expected 6");
|
||||
|
||||
document.body.appendChild(elem);
|
||||
ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
|
||||
ok(extern_cnt === 7, "extern_cnt = " + extern_cnt + " expected 7");
|
||||
}
|
||||
|
||||
document.body.onload = function() {
|
||||
ok(extern_cnt === 1, "extern_cnt = " + extern_cnt);
|
||||
try {
|
||||
testPutSrc2();
|
||||
testPutText2();
|
||||
}catch(e) {
|
||||
ok(false, "got an exception");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue