Commit 37e33999 authored by Savas Vedova's avatar Savas Vedova

Merge branch '349804-only-docs-links-in-new-tabs' into 'master'

Open doc links in new tab/window only

See merge request gitlab-org/gitlab!77849
parents 0f45394d a71a21fe
...@@ -31,6 +31,9 @@ export default { ...@@ -31,6 +31,9 @@ export default {
this.action === 'userAdded' && isExperimentVariant('invite_for_help_continuous_onboarding') this.action === 'userAdded' && isExperimentVariant('invite_for_help_continuous_onboarding')
); );
}, },
openInNewTab() {
return ACTION_LABELS[this.action]?.openInNewTab === true;
},
}, },
methods: { methods: {
openModal() { openModal() {
...@@ -61,8 +64,9 @@ export default { ...@@ -61,8 +64,9 @@ export default {
</gl-link> </gl-link>
<gl-link <gl-link
v-else v-else
target="_blank" :target="openInNewTab ? '_blank' : '_self'"
:href="value.url" :href="value.url"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
:data-track-label="$options.i18n.ACTION_LABELS[action].title" :data-track-label="$options.i18n.ACTION_LABELS[action].title"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
......
...@@ -62,6 +62,7 @@ export const ACTION_LABELS = { ...@@ -62,6 +62,7 @@ export const ACTION_LABELS = {
description: s__('LearnGitLab|Scan your code to uncover vulnerabilities before deploying.'), description: s__('LearnGitLab|Scan your code to uncover vulnerabilities before deploying.'),
section: 'deploy', section: 'deploy',
position: 1, position: 1,
openInNewTab: true,
}, },
issueCreated: { issueCreated: {
title: s__('LearnGitLab|Create an issue'), title: s__('LearnGitLab|Create an issue'),
......
...@@ -135,13 +135,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -135,13 +135,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Set up CI/CD" data-track-label="Set up CI/CD"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Set up CI/CD Set up CI/CD
...@@ -155,13 +155,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -155,13 +155,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Start a free Ultimate trial" data-track-label="Start a free Ultimate trial"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Start a free Ultimate trial Start a free Ultimate trial
...@@ -175,13 +175,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -175,13 +175,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Add code owners" data-track-label="Add code owners"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Add code owners Add code owners
...@@ -202,13 +202,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -202,13 +202,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Add merge request approval" data-track-label="Add merge request approval"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Add merge request approval Add merge request approval
...@@ -265,13 +265,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -265,13 +265,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Create an issue" data-track-label="Create an issue"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Create an issue Create an issue
...@@ -285,13 +285,13 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -285,13 +285,13 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Submit a merge request" data-track-label="Submit a merge request"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="http://example.com/"
rel="noopener noreferrer" target="_self"
target="_blank"
> >
Submit a merge request Submit a merge request
...@@ -341,11 +341,12 @@ exports[`Learn GitLab renders correctly 1`] = ` ...@@ -341,11 +341,12 @@ exports[`Learn GitLab renders correctly 1`] = `
> >
<a <a
class="gl-link" class="gl-link"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link" data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls" data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Run a Security scan using CI/CD" data-track-label="Run a Security scan using CI/CD"
data-track-property="Growth::Conversion::Experiment::LearnGitLab" data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/" href="https://docs.gitlab.com/ee/foobar/"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
......
...@@ -12,6 +12,10 @@ const defaultProps = { ...@@ -12,6 +12,10 @@ const defaultProps = {
completed: false, completed: false,
}; };
const docLinkProps = {
url: 'https://docs.gitlab.com/ee/user/application_security/security_dashboard/',
};
describe('Learn GitLab Section Link', () => { describe('Learn GitLab Section Link', () => {
let wrapper; let wrapper;
...@@ -53,6 +57,14 @@ describe('Learn GitLab Section Link', () => { ...@@ -53,6 +57,14 @@ describe('Learn GitLab Section Link', () => {
expect(wrapper.find('[data-testid="trial-only"]').exists()).toBe(true); expect(wrapper.find('[data-testid="trial-only"]').exists()).toBe(true);
}); });
it('renders doc links with blank target', () => {
createWrapper('securityScanEnabled', docLinkProps);
const linkElement = wrapper.find('[data-testid="uncompleted-learn-gitlab-link"]');
expect(linkElement.exists()).toBe(true);
expect(linkElement.attributes('target')).toEqual('_blank');
});
describe('rendering a link to open the invite_members modal instead of a regular link', () => { describe('rendering a link to open the invite_members modal instead of a regular link', () => {
it.each` it.each`
action | experimentVariant | showModal action | experimentVariant | showModal
......
...@@ -35,7 +35,7 @@ export const testActions = { ...@@ -35,7 +35,7 @@ export const testActions = {
svg: 'http://example.com/images/illustration.svg', svg: 'http://example.com/images/illustration.svg',
}, },
securityScanEnabled: { securityScanEnabled: {
url: 'http://example.com/', url: 'https://docs.gitlab.com/ee/foobar/',
completed: false, completed: false,
svg: 'http://example.com/images/illustration.svg', svg: 'http://example.com/images/illustration.svg',
}, },
......
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