47 |
var words = Array(); |
var words = Array(); |
48 |
var total_words = null; |
var total_words = null; |
49 |
|
|
50 |
function msg_debug(msg) { |
function create_color_msg(color,msg) { |
51 |
var e = document.createElement("span"); |
var e = document.createElement("span"); |
52 |
e.setAttribute('style', 'color: black;'); |
e.setAttribute('style', 'color: '+color); |
53 |
e.appendChild(document.createTextNode(msg)); |
e.appendChild(document.createTextNode(msg)); |
54 |
test_div.appendChild(e); |
return e; |
55 |
|
} |
56 |
|
|
57 |
|
function msg_debug(msg) { |
58 |
|
test_div.appendChild(create_color_msg('black',msg)); |
59 |
test_div.appendChild(document.createElement("br")); |
test_div.appendChild(document.createElement("br")); |
60 |
return; |
return; |
61 |
} |
} |
62 |
|
|
63 |
function msg_error(msg) { |
function msg_error(msg) { |
64 |
var e = document.createElement("span"); |
var e = create_color_msg('red',msg); |
|
e.setAttribute('style', 'color: red;'); |
|
|
e.appendChild(document.createTextNode(msg)); |
|
65 |
|
|
66 |
test_div.appendChild(e); |
test_div.appendChild(e); |
67 |
test_div.appendChild(document.createElement("br")); |
test_div.appendChild(document.createElement("br")); |
72 |
} |
} |
73 |
|
|
74 |
function msg_ok(msg) { |
function msg_ok(msg) { |
75 |
var e = document.createElement("span"); |
var e = create_color_msg('green',msg); |
|
e.setAttribute('style', 'color: green;'); |
|
|
e.appendChild(document.createTextNode(msg)); |
|
76 |
|
|
77 |
test_div.appendChild(e); |
test_div.appendChild(e); |
78 |
test_div.appendChild(document.createElement("br")); |
test_div.appendChild(document.createElement("br")); |
129 |
get_el('nr_tests').value = passed_tests + test_failed; |
get_el('nr_tests').value = passed_tests + test_failed; |
130 |
get_el('nr_passed').value = passed_tests; |
get_el('nr_passed').value = passed_tests; |
131 |
get_el('nr_failed').value = failed_tests; |
get_el('nr_failed').value = failed_tests; |
132 |
get_el('completed').value = (word_nr * 100 / total_words).toPrecision(4); |
get_el('completed').value = ((word_nr + 1) * 100 / total_words).toPrecision(4); |
133 |
|
|
134 |
// try next search |
// try next search |
135 |
if (word_nr < words.length) do_search(); |
if (word_nr < words.length) do_search(); |
175 |
|
|
176 |
} else { |
} else { |
177 |
msg_debug(""); |
msg_debug(""); |
178 |
msg_debug("tested "+word_nr+" words, "+passed_tests+" test passed, "+failed_tests+" test failed."); |
//msg_debug("tested "+word_nr+" words, "+passed_tests+" test passed, "+failed_tests+" test failed."); |
179 |
get_el('debug').appendChild(test_div); |
var r = create_color_msg('blue'," tested "+word_nr+" words, "); |
180 |
get_el('debug').appendChild(debug_div); |
r.appendChild(create_color_msg('green', passed_tests)); |
181 |
|
r.appendChild(create_color_msg('blue'," tests passed, ")); |
182 |
|
r.appendChild(create_color_msg('red', failed_tests)); |
183 |
|
r.appendChild(create_color_msg('blue'," tests failed.")); |
184 |
|
|
185 |
|
get_el('debug').appendChild(r); |
186 |
|
get_el('status').appendChild(r); |
187 |
} |
} |
188 |
} |
} |
189 |
|
|
192 |
|
|
193 |
<body onLoad="do_test();"> |
<body onLoad="do_test();"> |
194 |
|
|
195 |
<div style="color: blue;"> |
<div id="status" style="color: blue;"> |
196 |
This is test html for jsFind -- it might take a long time on slower |
This is test html for jsFind -- it might take a long time on slower |
197 |
computers and/or browsers, so please be patient! |
computers and/or browsers, so please be patient!<br/> |
198 |
</div> |
</div> |
199 |
|
|
200 |
<form> |
<form> |