Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Escue <scott.escue@gmail.com>2018-12-02 09:46:11 +0300
committerMike Greiling <mike@pixelcog.com>2019-01-10 09:00:39 +0300
commit87c571f8a3e9af9de0d979dc26f9838bb0fc924d (patch)
tree696c6b5f9e6d77996608acdd6f952826e2c52e8f /spec/javascripts/pages
parent2cbc475e5327a860032414561916c7bd725685ac (diff)
Addressing feedback from most recent reviews.
Diffstat (limited to 'spec/javascripts/pages')
-rw-r--r--spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js55
1 files changed, 41 insertions, 14 deletions
diff --git a/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js b/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js
index de308127a0f..7a8227479d4 100644
--- a/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js
+++ b/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js
@@ -2,33 +2,60 @@ import $ from 'jquery';
import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment';
describe('preserve_url_fragment', () => {
- preloadFixtures('static/signin_forms_and_buttons.html.raw');
+ preloadFixtures('sessions/new.html.raw');
beforeEach(() => {
- loadFixtures('static/signin_forms_and_buttons.html.raw');
+ loadFixtures('sessions/new.html.raw');
});
it('adds the url fragment to all login and sign up form actions', () => {
preserveUrlFragment('#L65');
- expect($('#new_ldap_user').attr('action')).toBe('/users/auth/ldapmain/callback#L65');
- expect($('#new_user').attr('action')).toBe('/users/sign_in#L65');
- expect($('#new_new_user').attr('action')).toBe('/users#L65');
+ expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in#L65');
+ expect($('#new_new_user').attr('action')).toBe('http://test.host/users#L65');
});
- it('adds the "redirect_fragment" query parameter to all OAuth and SAML login buttons', () => {
- preserveUrlFragment('#L65');
+ it('does not add an empty url fragment to login and sign up form actions', () => {
+ preserveUrlFragment();
+
+ expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in');
+ expect($('#new_new_user').attr('action')).toBe('http://test.host/users');
+ });
+
+ it('does not add an empty query parameter to OmniAuth login buttons', () => {
+ preserveUrlFragment();
+
+ expect($('#oauth-login-cas3').attr('href')).toBe('http://test.host/users/auth/cas3');
expect($('.omniauth-container #oauth-login-auth0').attr('href')).toBe(
- '/users/auth/auth0?redirect_fragment=L65',
+ 'http://test.host/users/auth/auth0',
);
+ });
- expect($('.omniauth-container #oauth-login-facebook').attr('href')).toBe(
- '/users/auth/facebook?remember_me=1&redirect_fragment=L65',
- );
+ describe('adds "redirect_fragment" query parameter to OmniAuth login buttons', () => {
+ it('when "remember_me" is not present', () => {
+ preserveUrlFragment('#L65');
- expect($('.omniauth-container #oauth-login-saml').attr('href')).toBe(
- '/users/auth/saml?redirect_fragment=L65',
- );
+ expect($('#oauth-login-cas3').attr('href')).toBe(
+ 'http://test.host/users/auth/cas3?redirect_fragment=L65',
+ );
+
+ expect($('.omniauth-container #oauth-login-auth0').attr('href')).toBe(
+ 'http://test.host/users/auth/auth0?redirect_fragment=L65',
+ );
+ });
+
+ it('when "remember-me" is present', () => {
+ $('a.omniauth-btn').attr('href', (i, href) => `${href}?remember_me=1`);
+ preserveUrlFragment('#L65');
+
+ expect($('#oauth-login-cas3').attr('href')).toBe(
+ 'http://test.host/users/auth/cas3?remember_me=1&redirect_fragment=L65',
+ );
+
+ expect($('#oauth-login-auth0').attr('href')).toBe(
+ 'http://test.host/users/auth/auth0?remember_me=1&redirect_fragment=L65',
+ );
+ });
});
});