Commit 4e2f4a62 authored by Justin Ho's avatar Justin Ho

Add specs and clean up code

- Add testid to Vue template as selectors
- Remove redundant rel attribute on gl-link
- Add specs to cover all changes
parent e627062e
......@@ -235,7 +235,7 @@ export default {
<gl-link
:href="issuable.web_url"
:target="isJiraIssue ? '_blank' : null"
:rel="isJiraIssue ? 'noopener noreferrer' : null"
data-testid="issuable-title"
>
{{ issuable.title }}
</gl-link>
......@@ -250,6 +250,7 @@ export default {
<span
v-if="isJiraIssue"
class="svg-container jira-logo-container"
data-testid="jira-logo"
v-html="jiraLogo"
></span>
{{ referencePath }}
......
......@@ -91,6 +91,8 @@ describe('Issuable component', () => {
const findBulkCheckbox = () => wrapper.find('input.selected-issuable');
const findScopedLabels = () => findLabels().filter(w => isScopedLabel({ title: w.text() }));
const findUnscopedLabels = () => findLabels().filter(w => !isScopedLabel({ title: w.text() }));
const findIssuableTitle = () => wrapper.find('[data-testid="issuable-title"]');
const containsJiraLogo = () => wrapper.contains('[data-testid="jira-logo"]');
describe('when mounted', () => {
it('initializes user popovers', () => {
......@@ -217,6 +219,22 @@ describe('Issuable component', () => {
});
});
describe('with Jira issuable', () => {
beforeEach(() => {
issuable.external_tracker = 'jira';
factory({ issuable });
});
it('renders the Jira icon', () => {
expect(containsJiraLogo()).toBe(true);
});
it('opens issuable in a new tab', () => {
expect(findIssuableTitle().props('target')).toBe('_blank');
});
});
describe('with task status', () => {
beforeEach(() => {
Object.assign(issuable, {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment