2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2018-03-17 18:26:18 +05:30
|
|
|
import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
describe('OAuthRememberMe', () => {
|
2019-07-07 11:18:12 +05:30
|
|
|
preloadFixtures('static/oauth_remember_me.html');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
2019-07-07 11:18:12 +05:30
|
|
|
loadFixtures('static/oauth_remember_me.html');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
new OAuthRememberMe({ container: $('#oauth-container') }).bindEvents();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('adds the "remember_me" query parameter to all OAuth login buttons', () => {
|
|
|
|
$('#oauth-container #remember_me').click();
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
expect($('#oauth-container .oauth-login.twitter').attr('href')).toBe(
|
|
|
|
'http://example.com/?remember_me=1',
|
|
|
|
);
|
|
|
|
|
|
|
|
expect($('#oauth-container .oauth-login.github').attr('href')).toBe(
|
|
|
|
'http://example.com/?remember_me=1',
|
|
|
|
);
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
expect($('#oauth-container .oauth-login.facebook').attr('href')).toBe(
|
|
|
|
'http://example.com/?redirect_fragment=L1&remember_me=1',
|
|
|
|
);
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
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/');
|
2019-03-02 22:35:43 +05:30
|
|
|
expect($('#oauth-container .oauth-login.facebook').attr('href')).toBe(
|
|
|
|
'http://example.com/?redirect_fragment=L1',
|
|
|
|
);
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
});
|