Skip to content

Commit

Permalink
feat(istanbul-reports): Enable keyboard shortcuts on HTML report file…
Browse files Browse the repository at this point in the history
… listing view (#265)

* Keyboard shortcuts for low coverage in file listing view

* Fix linting issues
  • Loading branch information
elliot-nelson authored and JaKXz committed Jan 12, 2019
1 parent 4390a11 commit f49b355
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/istanbul-reports/lib/html/assets/block-navigation.js
@@ -1,13 +1,19 @@
var jumpToCode = (function init() {
// Classes of code we would like to highlight
// Classes of code we would like to highlight in the file view
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];

// Elements to highlight in the file listing view
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) > `

// Selecter that finds elements on the page to which we can jump
var selector =
notSelector + missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
fileListingElements.join(', ') +
', ' +
notSelector +
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 Down

0 comments on commit f49b355

Please sign in to comment.