diff options
Diffstat (limited to 'coverage/htmlfiles/coverage_html.js')
-rw-r--r-- | coverage/htmlfiles/coverage_html.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index 1c4eb988..8b7fb96f 100644 --- a/coverage/htmlfiles/coverage_html.js +++ b/coverage/htmlfiles/coverage_html.js @@ -212,6 +212,11 @@ coverage.index_ready = function () { coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS"; coverage.pyfile_ready = function () { + cboxes = document.querySelectorAll('[id^=ctxs]') + cboxes.forEach(function(cbox) { + cbox.addEventListener("click", coverage.showContexts) + }); + // If we're directed to a particular line number, highlight the line. var frag = location.hash; if (frag.length > 2 && frag[1] === 't') { @@ -595,10 +600,26 @@ coverage.wire_up_sticky_header = function () { updateHeader(); }; +coverage.showContexts = function (e) { + span = e.target.nextElementSibling.nextElementSibling; + span_text = span.textContent; + + if (/^[0-9,]+$/.test(span_text)) + { + span.textContent = ""; + span_text.split(",").forEach(function(s) { + ctx = contexts[s]; + span.appendChild(document.createTextNode(ctx)); + span.appendChild(document.createElement("br")); + }) + } +}; + document.addEventListener("DOMContentLoaded", () => { if (document.body.classList.contains("indexfile")) { coverage.index_ready(); } else { coverage.pyfile_ready(); } + }); |