Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Sep 4, 2024
1 parent 8966a46 commit f20811b
Show file tree
Hide file tree
Showing 31 changed files with 26,499 additions and 2,380 deletions.
354 changes: 246 additions & 108 deletions packages/core/coverage/base.css

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions packages/core/coverage/block-navigation.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* eslint-disable */
var jumpToCode = (function init() {
// Classes of code we would like to highlight in the file view
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
var missingCoverageClasses = [".cbranch-no", ".cstat-no", ".fstat-no"];

// Elements to highlight in the file listing view
var fileListingElements = ['td.pct.low'];
var fileListingElements = ["td.pct.low"];

// We don't want to select elements that are direct descendants of another match
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
var notSelector = ":not(" + missingCoverageClasses.join("):not(") + ") > "; // becomes `:not(a):not(b) > `

// Selecter that finds elements on the page to which we can jump
var selector =
fileListingElements.join(', ') +
', ' +
fileListingElements.join(", ") +
", " +
notSelector +
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
missingCoverageClasses.join(", " + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`

// The NodeList of matching elements
var missingCoverageElements = document.querySelectorAll(selector);
Expand All @@ -24,23 +24,23 @@ var jumpToCode = (function init() {
function toggleClass(index) {
missingCoverageElements
.item(currentIndex)
.classList.remove('highlighted');
missingCoverageElements.item(index).classList.add('highlighted');
.classList.remove("highlighted");
missingCoverageElements.item(index).classList.add("highlighted");
}

function makeCurrent(index) {
toggleClass(index);
currentIndex = index;
missingCoverageElements.item(index).scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
behavior: "smooth",
block: "center",
inline: "center",
});
}

function goToPrevious() {
var nextIndex = 0;
if (typeof currentIndex !== 'number' || currentIndex === 0) {
if (typeof currentIndex !== "number" || currentIndex === 0) {
nextIndex = missingCoverageElements.length - 1;
} else if (missingCoverageElements.length > 1) {
nextIndex = currentIndex - 1;
Expand All @@ -53,7 +53,7 @@ var jumpToCode = (function init() {
var nextIndex = 0;

if (
typeof currentIndex === 'number' &&
typeof currentIndex === "number" &&
currentIndex < missingCoverageElements.length - 1
) {
nextIndex = currentIndex + 1;
Expand All @@ -64,7 +64,7 @@ var jumpToCode = (function init() {

return function jump(event) {
if (
document.getElementById('fileSearch') === document.activeElement &&
document.getElementById("fileSearch") === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
Expand All @@ -84,4 +84,4 @@ var jumpToCode = (function init() {
}
};
})();
window.addEventListener('keydown', jumpToCode);
window.addEventListener("keydown", jumpToCode);
21,964 changes: 21,947 additions & 17 deletions packages/core/coverage/coverage-final.json

Large diffs are not rendered by default.

Loading

0 comments on commit f20811b

Please sign in to comment.