diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-07-04 14:59:41 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-07-06 09:30:07 +0300 |
commit | 8d49a9fd580212b12bd719e6b310646e285c36b7 (patch) | |
tree | 32fec608811f939f70478b1e0449468a4565295d /spec/javascripts/oauth_remember_me_spec.js | |
parent | 7c2f5bb48d98426b8458782216311f24aa705209 (diff) |
Add Jasmine tests for `OAuthRememberMe`
Diffstat (limited to 'spec/javascripts/oauth_remember_me_spec.js')
-rw-r--r-- | spec/javascripts/oauth_remember_me_spec.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/javascripts/oauth_remember_me_spec.js b/spec/javascripts/oauth_remember_me_spec.js new file mode 100644 index 00000000000..f90e0093d25 --- /dev/null +++ b/spec/javascripts/oauth_remember_me_spec.js @@ -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/'); + }); +}); |