Commit 2c4d57ff authored by Filipa Lacerda's avatar Filipa Lacerda

Updates tests and i18n

parent e5e0acfc
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
%h4= _('Auto DevOps (Beta)') %h4= _('Auto DevOps (Beta)')
%p= _('Auto DevOps can be activated for this project. It will automatically build, test, and deploy your application based on a predefined CI/CD configuration.') %p= _('Auto DevOps can be activated for this project. It will automatically build, test, and deploy your application based on a predefined CI/CD configuration.')
%p %p
#{s_('LearnMoreInThe|Learn more in the')} #{s_('AutoDevOps|Learn more in the')}
= link_to _('Auto DevOps documentation'), help_page_path('topics/autodevops/index.md'), target: '_blank', rel: 'noopener noreferrer' = link_to _('Auto DevOps documentation'), help_page_path('topics/autodevops/index.md'), target: '_blank', rel: 'noopener noreferrer'
= link_to _('Enable in settings'), project_settings_ci_cd_path(@project, anchor: 'js-general-pipeline-settings'), class: 'btn btn-primary js-close-callout' = link_to _('Enable in settings'), project_settings_ci_cd_path(@project, anchor: 'js-general-pipeline-settings'), class: 'btn btn-primary js-close-callout'
...@@ -35,24 +35,15 @@ describe('UserCallout', function () { ...@@ -35,24 +35,15 @@ describe('UserCallout', function () {
}); });
describe('Sets cookie with setCalloutPerProject', () => { describe('Sets cookie with setCalloutPerProject', () => {
let originalGon;
beforeEach(() => { beforeEach(() => {
originalGon = window.gon; spyOn(Cookies, 'set').and.callFake(() => {});
window.gon = Object.assign({}, { document.querySelector('.user-callout').setAttribute('data-project-path', 'foo/bar');
project_url: 'http://localhost:3000/gitlab-org/gitlab-ce',
});
this.userCallout = new UserCallout({ setCalloutPerProject: true }); this.userCallout = new UserCallout({ setCalloutPerProject: true });
}); });
afterEach(() => {
window.gon = originalGon;
});
it('sets a cookie when the user clicks the close button', () => { it('sets a cookie when the user clicks the close button', () => {
this.userCalloutBtn.click(); this.userCalloutBtn.click();
// Note the path of a cookie is not accessible via JS, we can not test for that expect(Cookies.set).toHaveBeenCalledWith('user_callout_dismissed', 'true', Object({ expires: 365, path: 'foo/bar' }));
// We can test if a cookie is set when an option is provided
expect(Cookies.get(USER_CALLOUT_COOKIE)).toBe('true');
}); });
}); });
}); });
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