From 2b89020fe9638dc24b1635f4db5b1c0b664d1c8d Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Thu, 10 Oct 2024 11:44:09 +0200 Subject: [PATCH] fix(linting-tab): display unaltered name or ID Closes #4597 --- .../src/app/panel/tabs/linting/LintingTab.js | 7 +++---- .../tabs/linting/__tests__/LintingTabSpec.js | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/client/src/app/panel/tabs/linting/LintingTab.js b/client/src/app/panel/tabs/linting/LintingTab.js index 6d61888f0e..ec3d4639dc 100644 --- a/client/src/app/panel/tabs/linting/LintingTab.js +++ b/client/src/app/panel/tabs/linting/LintingTab.js @@ -149,8 +149,7 @@ function getReportName(report) { name, } = report; - const reportName = name || id || ''; - return reportName.toLowerCase(); + return name || id || ''; } /** @@ -176,8 +175,8 @@ function sortReports(reports) { } if (a.category === b.category) { - a = getReportName(a), - b = getReportName(b); + a = getReportName(a).toLowerCase(), + b = getReportName(b).toLowerCase(); if (a === b) { return 0; diff --git a/client/src/app/panel/tabs/linting/__tests__/LintingTabSpec.js b/client/src/app/panel/tabs/linting/__tests__/LintingTabSpec.js index f426931bb1..8f7df3f3ad 100644 --- a/client/src/app/panel/tabs/linting/__tests__/LintingTabSpec.js +++ b/client/src/app/panel/tabs/linting/__tests__/LintingTabSpec.js @@ -37,6 +37,8 @@ describe('', function() { expect(wrapper.find('.panel__link').at(0).find('.panel__link-label').text()).to.equal('Problems'); expect(wrapper.find('.panel__link').at(0).hasClass('panel__link--active')).to.be.true; + expect(wrapper.find('.linting-tab-item__label')).to.have.length(1); + expect(wrapper.find('.linting-tab-item__label').text()).to.equal('Foo'); expect(wrapper.find('.linting-tab-item__content')).to.have.length(1); expect(wrapper.find('.linting-tab-item__content').text()).to.equal('Foo message'); }); @@ -61,6 +63,8 @@ describe('', function() { }); // then + expect(wrapper.find('.linting-tab-item__label')).to.have.length(1); + expect(wrapper.find('.linting-tab-item__label').text()).to.equal('Foo'); expect(wrapper.find('.linting-tab-item__content')).to.have.length(1); expect(wrapper.find('.linting-tab-item__content').text()).to.equal('Foo message'); expect(wrapper.find('.linting-tab-item__link')).to.have.length(1); @@ -81,6 +85,8 @@ describe('', function() { }); // then + expect(wrapper.find('.linting-tab-item__label')).to.have.length(1); + expect(wrapper.find('.linting-tab-item__label').text()).to.equal('Rule error'); expect(wrapper.find('.linting-tab-item__content')).to.have.length(1); expect(wrapper.find('.linting-tab-item__content').text()).to.equal('Rule errored with the following message: Bar'); }); @@ -158,13 +164,28 @@ describe('', function() { }); // then + expect(wrapper.find('.linting-tab-item__label')).to.have.length(7); expect(wrapper.find('.linting-tab-item__content')).to.have.length(7); + + expect(wrapper.find('.linting-tab-item__label').at(0).text()).to.equal('Bar 1'); expect(wrapper.find('.linting-tab-item__content').at(0).text()).to.equal('bar 1 error'); + + expect(wrapper.find('.linting-tab-item__label').at(1).text()).to.equal('Bar 2'); expect(wrapper.find('.linting-tab-item__content').at(1).text()).to.equal('bar 2 error'); + + expect(wrapper.find('.linting-tab-item__label').at(2).text()).to.equal('baz'); expect(wrapper.find('.linting-tab-item__content').at(2).text()).to.equal('baz 2 error'); + + expect(wrapper.find('.linting-tab-item__label').at(3).text()).to.equal('Foo'); expect(wrapper.find('.linting-tab-item__content').at(3).text()).to.equal('foo error'); + + expect(wrapper.find('.linting-tab-item__label').at(4).text()).to.equal('baz'); expect(wrapper.find('.linting-tab-item__content').at(4).text()).to.equal('baz 1 warning'); + + expect(wrapper.find('.linting-tab-item__label').at(5).text()).to.equal('baz'); expect(wrapper.find('.linting-tab-item__content').at(5).text()).to.equal('baz 1 info'); + + expect(wrapper.find('.linting-tab-item__label').at(6).text()).to.equal('Rule error'); expect(wrapper.find('.linting-tab-item__content').at(6).text()).to.equal('Rule errored with the following message: Baz'); });