Add Jasmine tests for OAuthRememberMe
This commit is contained in:
parent
7c2f5bb48d
commit
8d49a9fd58
2 changed files with 31 additions and 0 deletions
5
spec/javascripts/fixtures/oauth_remember_me.html.haml
Normal file
5
spec/javascripts/fixtures/oauth_remember_me.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#oauth-container
|
||||||
|
%input#remember_me{ type: "checkbox" }
|
||||||
|
|
||||||
|
%a.oauth-login.twitter{ href: "http://example.com/" }
|
||||||
|
%a.oauth-login.github{ href: "http://example.com/" }
|
26
spec/javascripts/oauth_remember_me_spec.js
Normal file
26
spec/javascripts/oauth_remember_me_spec.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import OAuthRememberMe from '~/oauth_remember_me';
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
|
||||||
|
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/');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue