2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2018-01-10 13:56:15 -05:00
|
|
|
import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me';
|
2017-07-04 07:59:41 -04:00
|
|
|
|
|
|
|
describe('OAuthRememberMe', () => {
|
|
|
|
preloadFixtures('static/oauth_remember_me.html.raw');
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
loadFixtures('static/oauth_remember_me.html.raw');
|
|
|
|
|
|
|
|
new OAuthRememberMe({ container: $('#oauth-container') }).bindEvents();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('adds the "remember_me" query parameter to all OAuth login buttons', () => {
|
|
|
|
$('#oauth-container #remember_me').click();
|
|
|
|
|
2018-10-17 03:13:26 -04:00
|
|
|
expect($('#oauth-container .oauth-login.twitter').attr('href')).toBe(
|
|
|
|
'http://example.com/?remember_me=1',
|
|
|
|
);
|
2018-10-17 03:21:28 -04:00
|
|
|
|
2018-10-17 03:13:26 -04:00
|
|
|
expect($('#oauth-container .oauth-login.github').attr('href')).toBe(
|
|
|
|
'http://example.com/?remember_me=1',
|
|
|
|
);
|
2018-06-04 17:30:59 -04:00
|
|
|
|
|
|
|
expect($('#oauth-container .oauth-login.facebook').attr('href')).toBe(
|
2018-11-27 08:16:24 -05:00
|
|
|
'http://example.com/?redirect_fragment=L1&remember_me=1',
|
2018-06-04 17:30:59 -04:00
|
|
|
);
|
2017-07-04 07:59:41 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('removes the "remember_me" query parameter from all OAuth login buttons', () => {
|
|
|
|
$('#oauth-container #remember_me').click();
|
|
|
|
$('#oauth-container #remember_me').click();
|
|
|
|
|
|
|
|
expect($('#oauth-container .oauth-login.twitter').attr('href')).toBe('http://example.com/');
|
|
|
|
expect($('#oauth-container .oauth-login.github').attr('href')).toBe('http://example.com/');
|
2018-11-27 08:16:24 -05:00
|
|
|
expect($('#oauth-container .oauth-login.facebook').attr('href')).toBe(
|
|
|
|
'http://example.com/?redirect_fragment=L1',
|
|
|
|
);
|
2017-07-04 07:59:41 -04:00
|
|
|
});
|
|
|
|
});
|