MCPcopy Index your code
hub / github.com/prototypejs/prototype / HTML

Function HTML

test/unit/static/js/mocha.js:2329–2473  ·  view source on GitHub ↗

* Initialize a new `Doc` reporter. * * @param {Runner} runner * @api public

(runner, root)

Source from the content-addressed store, hash-verified

2327 */
2328
2329function HTML(runner, root) {
2330 Base.call(this, runner);
2331
2332 var self = this
2333 , stats = this.stats
2334 , total = runner.total
2335 , stat = fragment(statsTemplate)
2336 , items = stat.getElementsByTagName('li')
2337 , passes = items[1].getElementsByTagName('em')[0]
2338 , passesLink = items[1].getElementsByTagName('a')[0]
2339 , pending = items[2].getElementsByTagName('em')[0]
2340 , pendingLink = items[2].getElementsByTagName('a')[0]
2341 , failures = items[3].getElementsByTagName('em')[0]
2342 , failuresLink = items[3].getElementsByTagName('a')[0]
2343 , duration = items[4].getElementsByTagName('em')[0]
2344 , canvas = stat.getElementsByTagName('canvas')[0]
2345 , report = fragment('<ul id="mocha-report"></ul>')
2346 , stack = [report]
2347 , progress
2348 , ctx
2349
2350 root = root || document.getElementById('mocha');
2351
2352 if (canvas.getContext) {
2353 var ratio = window.devicePixelRatio || 1;
2354 canvas.style.width = canvas.width;
2355 canvas.style.height = canvas.height;
2356 canvas.width *= ratio;
2357 canvas.height *= ratio;
2358 ctx = canvas.getContext('2d');
2359 ctx.scale(ratio, ratio);
2360 progress = new Progress;
2361 }
2362
2363 if (!root) return error('#mocha div missing, add it to your document');
2364
2365 // pass toggle
2366 on(passesLink, 'click', function(){
2367 unhide();
2368 var name = /pass/.test(report.className) ? '' : ' pass';
2369 report.className = report.className.replace(/fail|pass|pending/g, '') + name;
2370 if (report.className.trim()) hideSuitesWithout('test pass');
2371 });
2372
2373 // pending toggle
2374 on(pendingLink, 'click', function(){
2375 unhide();
2376 var name = /pending/.test(report.className) ? '' : ' pending';
2377 report.className = report.className.replace(/fail|pass|pending/g, '') + name;
2378 if (report.className.trim()) hideSuitesWithout('test pending');
2379 });
2380
2381 // failure toggle
2382 on(failuresLink, 'click', function(){
2383 unhide();
2384 var name = /fail/.test(report.className) ? '' : ' fail';
2385 report.className = report.className.replace(/fail|pass|pending/g, '') + name;
2386 if (report.className.trim()) hideSuitesWithout('test fail');

Callers

nothing calls this directly

Calls 7

fragmentFunction · 0.85
errorFunction · 0.85
unhideFunction · 0.85
hideSuitesWithoutFunction · 0.85
escapeFunction · 0.85
textFunction · 0.85
onFunction · 0.70

Tested by

no test coverage detected