Skip to content

Commit

Permalink
fix(linting-tab): display unaltered name or ID
Browse files Browse the repository at this point in the history
Closes #4597
  • Loading branch information
philippfromme committed Oct 10, 2024
1 parent 388d7ed commit 2b89020
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client/src/app/panel/tabs/linting/LintingTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ function getReportName(report) {
name,
} = report;

const reportName = name || id || '';
return reportName.toLowerCase();
return name || id || '';
}

/**
Expand All @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions client/src/app/panel/tabs/linting/__tests__/LintingTabSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ describe('<LintingTab>', 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');
});
Expand All @@ -61,6 +63,8 @@ describe('<LintingTab>', 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);
Expand All @@ -81,6 +85,8 @@ describe('<LintingTab>', 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 <bar-rule> errored with the following message: Bar');
});
Expand Down Expand Up @@ -158,13 +164,28 @@ describe('<LintingTab>', 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 <baz-rule> errored with the following message: Baz');
});

Expand Down

0 comments on commit 2b89020

Please sign in to comment.