Commit 9d16138e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mw-onboarding-welcome-page-additions' into 'master'

Conditionally display link text on welcome page

See merge request gitlab-org/gitlab-ee!14133
parents b6dfecb7 418b5d96
...@@ -28,6 +28,10 @@ export default { ...@@ -28,6 +28,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
fromHelpMenu: {
type: Boolean,
required: true,
},
}, },
data() { data() {
return { return {
...@@ -48,6 +52,11 @@ export default { ...@@ -48,6 +52,11 @@ export default {
}, },
}; };
}, },
computed: {
skipText() {
return this.fromHelpMenu ? __('No, not interested right now') : __('Skip this for now');
},
},
mounted() { mounted() {
this.helpPopover.target = this.$refs.helpPopoverTrigger; this.helpPopover.target = this.$refs.helpPopoverTrigger;
this.actionPopover.target = this.$refs.actionPopoverTrigger; this.actionPopover.target = this.$refs.actionPopoverTrigger;
...@@ -121,7 +130,7 @@ export default { ...@@ -121,7 +130,7 @@ export default {
</gl-link> </gl-link>
<p class="small mt-8"> <p class="small mt-8">
<gl-link class="qa-skip-tour-btn" @click="skipTour"> <gl-link class="qa-skip-tour-btn" @click="skipTour">
{{ __('Skip this for now') }} {{ skipText }}
</gl-link> </gl-link>
</p> </p>
<p class="small ml-4 mr-4" v-html="helpText"></p> <p class="small ml-4 mr-4" v-html="helpText"></p>
......
import Vue from 'vue'; import Vue from 'vue';
import WelcomePage from './components/welcome_page.vue'; import WelcomePage from './components/welcome_page.vue';
import { parseBoolean } from '~/lib/utils/common_utils';
export default function() { export default function() {
const el = document.getElementById('js-onboarding-welcome'); const el = document.getElementById('js-onboarding-welcome');
...@@ -8,7 +9,7 @@ export default function() { ...@@ -8,7 +9,7 @@ export default function() {
return false; return false;
} }
const { userAvatarUrl, projectFullPath, skipUrl } = el.dataset; const { userAvatarUrl, projectFullPath, skipUrl, fromHelpMenu } = el.dataset;
return new Vue({ return new Vue({
el, el,
...@@ -18,6 +19,7 @@ export default function() { ...@@ -18,6 +19,7 @@ export default function() {
userAvatarUrl, userAvatarUrl,
projectFullPath, projectFullPath,
skipUrl, skipUrl,
fromHelpMenu: parseBoolean(fromHelpMenu),
}, },
}); });
}, },
......
.container.container-limited.limit-container-width.navless-container .container.container-limited.limit-container-width.navless-container
#js-onboarding-welcome{ data: { user_avatar_url: avatar_icon_for_user(current_user), project_full_path: @project.web_url, skip_url: root_dashboard_path } } #js-onboarding-welcome{ data: { user_avatar_url: avatar_icon_for_user(current_user), project_full_path: @project.web_url, skip_url: root_dashboard_path, from_help_menu: params[:from_help_menu] } }
- return unless user_onboarding_enabled? - return unless user_onboarding_enabled?
%li %li.d-none.d-lg-block
%a{ href: explore_onboarding_index_path } %a{ href: explore_onboarding_index_path(from_help_menu: true) }
= _("Learn GitLab") = _("Learn GitLab")
%span.badge.badge-success= s_("Badge|New") %span.badge.badge-success= s_("Badge|New")
...@@ -24,7 +24,7 @@ describe 'User Onboarding' do ...@@ -24,7 +24,7 @@ describe 'User Onboarding' do
find('.header-help-dropdown-toggle').click find('.header-help-dropdown-toggle').click
page.within('.header-help') do page.within('.header-help') do
expect(page).to have_link('Learn GitLab', href: explore_onboarding_index_path) expect(page).to have_link('Learn GitLab', href: explore_onboarding_index_path(from_help_menu: true))
end end
end end
end end
......
...@@ -12,17 +12,24 @@ describe('User onboarding welcome page', () => { ...@@ -12,17 +12,24 @@ describe('User onboarding welcome page', () => {
userAvatarUrl: 'my-user.avatar.com', userAvatarUrl: 'my-user.avatar.com',
projectFullPath: 'my-dummy-project/path', projectFullPath: 'my-dummy-project/path',
skipUrl: 'skip.url.com', skipUrl: 'skip.url.com',
fromHelpMenu: false,
}; };
function createComponent(propsData) {
wrapper = shallowMount(component, { propsData });
}
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
}); });
beforeEach(done => { beforeEach(done => {
wrapper = shallowMount(component, { propsData: props }); createComponent(props);
Vue.nextTick(done); Vue.nextTick(done);
}); });
const findSkipBtn = () => wrapper.find('.qa-skip-tour-btn');
describe('methods', () => { describe('methods', () => {
describe('startTour', () => { describe('startTour', () => {
it('resets the localStorage', done => { it('resets the localStorage', done => {
...@@ -147,11 +154,21 @@ describe('User onboarding welcome page', () => { ...@@ -147,11 +154,21 @@ describe('User onboarding welcome page', () => {
expect(btn.text()).toContain("Ok let's go"); expect(btn.text()).toContain("Ok let's go");
}); });
it('displays the "Skip this for now" link', () => { it('displays "Skip this for now" as link text if fromHelpMenu is false', () => {
const btn = wrapper.find('.qa-skip-tour-btn'); expect(findSkipBtn().exists()).toBe(true);
expect(findSkipBtn().text()).toContain('Skip this for now');
});
it('displays "No, not interested right now" as link text if fromHelpMenu is true', () => {
const propsData = {
...props,
fromHelpMenu: true,
};
expect(btn.exists()).toBe(true); createComponent(propsData);
expect(btn.text()).toContain('Skip this for now');
expect(findSkipBtn().exists()).toBe(true);
expect(findSkipBtn().text()).toContain('No, not interested right now');
}); });
it('displays a note on how users can start the tour from the help menu', () => { it('displays a note on how users can start the tour from the help menu', () => {
......
...@@ -8868,6 +8868,9 @@ msgstr "" ...@@ -8868,6 +8868,9 @@ msgstr ""
msgid "No, directly import the existing email addresses and usernames." msgid "No, directly import the existing email addresses and usernames."
msgstr "" msgstr ""
msgid "No, not interested right now"
msgstr ""
msgid "Node was successfully created." msgid "Node was successfully created."
msgstr "" msgstr ""
......
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