From 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Mar 2022 19:02:27 +0200 Subject: Added node_modules for the updating to work properly. --- .../lib/html-spa/src/summaryTableHeader.js | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js (limited to 'node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js') diff --git a/node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js b/node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js new file mode 100644 index 0000000..7cf964e --- /dev/null +++ b/node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js @@ -0,0 +1,130 @@ +const React = require('react'); + +function getSortDetails(sortKey, activeSort) { + let newSort = { sortKey, order: 'desc' }; + let sortClass = ''; + if (activeSort && activeSort.sortKey === sortKey) { + sortClass = 'sorted'; + if (activeSort.order === 'desc') { + sortClass += '-desc'; + newSort.order = 'asc'; + } else { + if (sortKey !== 'file') { + newSort = { sortKey: 'file', order: 'desc' }; + } + } + } + + return { + newSort, + sortClass + }; +} + +function SummaryTableHeaderCell({ name, onSort, sortKey, activeSort }) { + const { newSort, sortClass } = getSortDetails(sortKey, activeSort); + return ( + onSort(newSort)} + > + {name} + + + ); +} + +function FileHeaderCell({ onSort, activeSort }) { + const { newSort, sortClass } = getSortDetails('file', activeSort); + + return ( + onSort(newSort)} + > + File + + + ); +} + +function SubHeadings({ sortKeyPrefix, onSort, activeSort }) { + return ( + <> + + + + + + + ); +} + +module.exports = function SummaryTableHeader({ + onSort, + activeSort, + metricsToShow +}) { + return ( + + + + {metricsToShow.statements && Statements} + {metricsToShow.branches && Branches} + {metricsToShow.functions && Functions} + {metricsToShow.lines && Lines} + + + + {metricsToShow.statements && ( + + )} + {metricsToShow.branches && ( + + )} + {metricsToShow.functions && ( + + )} + {metricsToShow.lines && ( + + )} + + + ); +}; -- cgit v1.2.3