Skip to content

Commit e80169e

Browse files
jacobseeJacob See
andauthored
External link icon updates (#565)
* Make icons smaller, add them to more places which pop out * Dynamically add 'nowrap' between last word and external link icon * Update test snapshots * Only match until the last word in tests where we expect a popout icon to render * back to work in the unit test mines Co-authored-by: Jacob See <[email protected]>
1 parent b970d2e commit e80169e

File tree

10 files changed

+930
-50
lines changed

10 files changed

+930
-50
lines changed

src/assets/css/overrides.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
margin-right: 14px !important;
1111
}
1212

13+
.externalAltLinkIcon {
14+
display: inline-block;
15+
width: 0.7em;
16+
height: 0.7em;
17+
vertical-align: baseline !important;
18+
}
19+
20+
.nowrap {
21+
white-space: nowrap;
22+
}
23+
1324
/* .pf-c-page__main {
1425
z-index: 301;
1526
}

src/components/activity_history_line_item/activity_history_line_item.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
23
import { differenceInDays } from 'date-fns';
34
import { GitCommit } from '../../schemas/git_commit';
45
import {
@@ -91,7 +92,7 @@ function CommitData({ commit }: { commit: GitCommit }) {
9192
<span style={{ whiteSpace: 'pre-wrap' }}>{commit.message}</span>
9293
</div>
9394
<div>
94-
<a href={commit.web_url} target="_blank" rel="noopener noreferrer">See in GitLab</a>
95+
<a href={commit.web_url} target="_blank" rel="noopener noreferrer" className="nowrap">See in GitLab&nbsp;&nbsp;<ExternalLinkAltIcon className="externalAltLinkIcon"/></a>
9596
</div>
9697
</div>
9798
);

src/components/dashboard/widgets/dw_last_artifact.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { render } from '@testing-library/react';
22
import React from 'react';
33
import { createMemoryHistory } from 'history';
44
import { Router } from 'react-router';
5-
import { mockEngagementArtifact, mockEngagementUseCase } from '../../../mocks/engagement_mocks';
5+
import { mockEngagementArtifact } from '../../../mocks/engagement_mocks';
66
import { DwLastArtifacts } from './dw_last_artifact';
7-
import { DwLastUseCases } from './dw_last_use_cases';
87

98
describe('Last Use Cases dashboard widget', () => {
109
test('has the correct title', () => {
@@ -23,7 +22,8 @@ describe('Last Use Cases dashboard widget', () => {
2322
</Router>
2423
);
2524
for (let artifact of artifacts) {
26-
expect(component.getByText(artifact.description)).toBeDefined();
25+
expect(component.getByText(artifact.description.substring(0, artifact.description.lastIndexOf(" ")))).toBeDefined();
26+
// The last word will be wrapped in a span with an icon, so only match until the last space
2727
}
2828
});
2929
});

src/components/dashboard/widgets/dw_last_demo.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('Dashboard last demos', () => {
1818
</MemoryRouter>
1919
);
2020
for (let demo of demos) {
21-
expect(component.getByText(demo.description)).toBeDefined();
21+
expect(component.getByText(demo.description.substring(0, demo.description.lastIndexOf(" ")))).toBeDefined();
22+
// The last word will be wrapped in a span with an icon, so only match until the last space
2223
}
2324
});
2425
});

src/components/dashboard/widgets/dw_last_use_cases.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Router } from 'react-router';
55
import { mockEngagementUseCase } from '../../../mocks/engagement_mocks';
66
import { DwLastUseCases } from './dw_last_use_cases';
77

8+
89
describe('Last Use Cases dashboard widget', () => {
910
test('has the correct title', () => {
1011
const component = render(

src/components/dashboard/widgets/dw_last_weekly_report.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ describe('Dashboard last weekly reports', () => {
2222
</MemoryRouter>
2323
);
2424
for (let report of weeklyReports) {
25-
expect(component.getByText(report.description)).toBeDefined();
25+
expect(component.getByText(report.description.substring(0, report.description.lastIndexOf(" ")))).toBeDefined();
26+
// The last word will be wrapped in a span with an icon, so only match until the last space
2627
}
2728
});
2829
});

0 commit comments

Comments
 (0)