Commit dcb61727 authored by Tom Quirk's avatar Tom Quirk

Address reviewer feedback

parent 7cfd6d20
...@@ -36,13 +36,8 @@ export default { ...@@ -36,13 +36,8 @@ export default {
return `${gon.gitlab_url}/${gon.current_username}`; return `${gon.gitlab_url}/${gon.current_username}`;
}, },
}, },
created() { async created() {
this.setSignInURL(); this.signInURL = await getGitlabSignInURL(this.usersPath);
},
methods: {
async setSignInURL() {
this.signInURL = await getGitlabSignInURL(this.usersPath);
},
}, },
i18n: { i18n: {
signInText: __('Sign in to GitLab'), signInText: __('Sign in to GitLab'),
...@@ -54,12 +49,7 @@ export default { ...@@ -54,12 +49,7 @@ export default {
<div class="jira-connect-user gl-font-base"> <div class="jira-connect-user gl-font-base">
<gl-sprintf v-if="userSignedIn" :message="$options.i18n.signedInAsUserText"> <gl-sprintf v-if="userSignedIn" :message="$options.i18n.signedInAsUserText">
<template #user_link> <template #user_link>
<gl-link <gl-link data-testid="gitlab-user-link" :href="gitlabUserLink" target="_blank">
data-testid="gitlab-user-link"
:href="gitlabUserLink"
rel="noopener noreferrer"
target="_blank"
>
{{ gitlabUserHandle }} {{ gitlabUserHandle }}
</gl-link> </gl-link>
</template> </template>
...@@ -69,7 +59,6 @@ export default { ...@@ -69,7 +59,6 @@ export default {
v-else-if="hasSubscriptions" v-else-if="hasSubscriptions"
data-testid="sign-in-link" data-testid="sign-in-link"
:href="signInURL" :href="signInURL"
rel="noopener noreferrer"
target="_blank" target="_blank"
> >
{{ $options.i18n.signInText }} {{ $options.i18n.signInText }}
......
import { shallowMount } from '@vue/test-utils';
import { GlSprintf } from '@gitlab/ui'; import { GlSprintf } from '@gitlab/ui';
import UserLink from '~/jira_connect/subscriptions/components/user_link.vue'; import UserLink from '~/jira_connect/subscriptions/components/user_link.vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
jest.mock('~/jira_connect/subscriptions/utils', () => ({ jest.mock('~/jira_connect/subscriptions/utils', () => ({
...@@ -11,7 +11,7 @@ describe('SubscriptionsList', () => { ...@@ -11,7 +11,7 @@ describe('SubscriptionsList', () => {
let wrapper; let wrapper;
const createComponent = (propsData = {}, { provide } = {}) => { const createComponent = (propsData = {}, { provide } = {}) => {
wrapper = shallowMount(UserLink, { wrapper = shallowMountExtended(UserLink, {
propsData, propsData,
provide, provide,
stubs: { stubs: {
...@@ -20,8 +20,8 @@ describe('SubscriptionsList', () => { ...@@ -20,8 +20,8 @@ describe('SubscriptionsList', () => {
}); });
}; };
const findSignInLink = () => wrapper.find('[data-testid="sign-in-link"]'); const findSignInLink = () => wrapper.findByTestId('sign-in-link');
const findGitlabUserLink = () => wrapper.find('[data-testid="gitlab-user-link"]'); const findGitlabUserLink = () => wrapper.findByTestId('gitlab-user-link');
const findSprintf = () => wrapper.findComponent(GlSprintf); const findSprintf = () => wrapper.findComponent(GlSprintf);
afterEach(() => { afterEach(() => {
......
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