Commit 89b2276b authored by Mark Florian's avatar Mark Florian

Merge branch '344302' into 'master'

Update badge in accessibility issue body

See merge request gitlab-org/gitlab!79777
parents b4672964 ce8ed5b3
<script> <script>
import { GlLink } from '@gitlab/ui'; import { GlBadge, GlLink } from '@gitlab/ui';
export default { export default {
name: 'AccessibilityIssueBody', name: 'AccessibilityIssueBody',
components: { components: {
GlBadge,
GlLink, GlLink,
}, },
props: { props: {
...@@ -38,9 +39,9 @@ export default { ...@@ -38,9 +39,9 @@ export default {
<template> <template>
<div class="report-block-list-issue-description gl-mt-2 gl-mb-2"> <div class="report-block-list-issue-description gl-mt-2 gl-mb-2">
<div ref="accessibility-issue-description" class="report-block-list-issue-description-text"> <div ref="accessibility-issue-description" class="report-block-list-issue-description-text">
<div v-if="isNew" ref="accessibility-issue-is-new-badge" class="badge badge-danger gl-mr-2"> <gl-badge v-if="isNew" class="gl-mr-2" variant="danger">{{
{{ s__('AccessibilityReport|New') }} s__('AccessibilityReport|New')
</div> }}</gl-badge>
<div> <div>
{{ {{
sprintf( sprintf(
......
import { GlBadge } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import AccessibilityIssueBody from '~/reports/accessibility_report/components/accessibility_issue_body.vue'; import AccessibilityIssueBody from '~/reports/accessibility_report/components/accessibility_issue_body.vue';
...@@ -29,7 +30,7 @@ describe('CustomMetricsForm', () => { ...@@ -29,7 +30,7 @@ describe('CustomMetricsForm', () => {
}); });
}; };
const findIsNewBadge = () => wrapper.find({ ref: 'accessibility-issue-is-new-badge' }); const findIsNewBadge = () => wrapper.findComponent(GlBadge);
beforeEach(() => { beforeEach(() => {
mountComponent(issue); mountComponent(issue);
...@@ -37,7 +38,6 @@ describe('CustomMetricsForm', () => { ...@@ -37,7 +38,6 @@ describe('CustomMetricsForm', () => {
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}); });
it('Displays the issue message', () => { it('Displays the issue message', () => {
...@@ -52,7 +52,7 @@ describe('CustomMetricsForm', () => { ...@@ -52,7 +52,7 @@ describe('CustomMetricsForm', () => {
.find({ ref: 'accessibility-issue-learn-more' }) .find({ ref: 'accessibility-issue-learn-more' })
.attributes('href'); .attributes('href');
expect(learnMoreUrl).toEqual(issue.learnMoreUrl); expect(learnMoreUrl).toBe(issue.learnMoreUrl);
}); });
}); });
...@@ -69,7 +69,7 @@ describe('CustomMetricsForm', () => { ...@@ -69,7 +69,7 @@ describe('CustomMetricsForm', () => {
.find({ ref: 'accessibility-issue-learn-more' }) .find({ ref: 'accessibility-issue-learn-more' })
.attributes('href'); .attributes('href');
expect(learnMoreUrl).toEqual('https://www.w3.org/TR/WCAG20-TECHS/Overview.html'); expect(learnMoreUrl).toBe('https://www.w3.org/TR/WCAG20-TECHS/Overview.html');
}); });
}); });
...@@ -86,7 +86,7 @@ describe('CustomMetricsForm', () => { ...@@ -86,7 +86,7 @@ describe('CustomMetricsForm', () => {
.find({ ref: 'accessibility-issue-learn-more' }) .find({ ref: 'accessibility-issue-learn-more' })
.attributes('href'); .attributes('href');
expect(learnMoreUrl).toEqual('https://www.w3.org/TR/WCAG20-TECHS/Overview.html'); expect(learnMoreUrl).toBe('https://www.w3.org/TR/WCAG20-TECHS/Overview.html');
}); });
}); });
...@@ -96,7 +96,7 @@ describe('CustomMetricsForm', () => { ...@@ -96,7 +96,7 @@ describe('CustomMetricsForm', () => {
}); });
it('Renders the new badge', () => { it('Renders the new badge', () => {
expect(findIsNewBadge().exists()).toEqual(true); expect(findIsNewBadge().exists()).toBe(true);
}); });
}); });
...@@ -106,7 +106,7 @@ describe('CustomMetricsForm', () => { ...@@ -106,7 +106,7 @@ describe('CustomMetricsForm', () => {
}); });
it('Does not render the new badge', () => { it('Does not render the new badge', () => {
expect(findIsNewBadge().exists()).toEqual(false); expect(findIsNewBadge().exists()).toBe(false);
}); });
}); });
}); });
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