diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 5044443a0a9..fb263c73d12 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -278,7 +278,7 @@ HTML_HEAD = """ updateFileRows(); } - + function toggleClassification(cb) { cb.parentElement.classList.toggle("unchecked", !cb.checked); var elements = document.querySelectorAll(".class_" + cb.id); @@ -289,7 +289,7 @@ HTML_HEAD = """ updateFileRows(); } - + function toggleTool(cb) { cb.parentElement.classList.toggle("unchecked", !cb.checked); @@ -469,9 +469,9 @@ def filter_button(enabled_filters, id, function): def filter_bar(enabled): severity_bar = ''.join([filter_button(enabled, severity, 'toggleSeverity') for severity in ['error', 'warning', 'portability', 'performance', 'style', 'information']]) + '\n | ' classification_bar = ''.join([filter_button(enabled, _class, 'toggleClassification') for _class in ['Mandatory', 'Required', 'Advisory', 'Document', 'Disapplied', 'L1','L2','L3','']]) + '\n | ' - if "checked/>" not in severity_bar: + if "checked>" not in severity_bar: severity_bar = '' - if "checked/>" not in classification_bar: + if "checked>" not in classification_bar: classification_bar = '' return ''.join([ '
\n' diff --git a/test/tools/htmlreport/test_htmlreport.py b/test/tools/htmlreport/test_htmlreport.py index 6f8713f4f55..f84fd279fb3 100755 --- a/test/tools/htmlreport/test_htmlreport.py +++ b/test/tools/htmlreport/test_htmlreport.py @@ -107,6 +107,13 @@ def testAddTimestamp(self): output_directory.cleanup() + def testSeverityFilterBar(self): + with runCheck( + xml_filename=os.path.join(TEST_TOOLS_DIR, 'example.xml'), + ) as (report, output_directory): + self.assertIn('onclick="toggleSeverity(this)"', report) + output_directory.cleanup() + @contextlib.contextmanager def runCheck(source_filename=None, xml_version='1', xml_filename=None, checkers_filename=None):