diff options
author | Jefferson Stachelski <jeffhsta@riseup.net> | 2015-12-03 20:56:47 -0200 |
---|---|---|
committer | Pixelated <pixelated@pix-poa-1> | 2015-12-03 21:16:58 -0200 |
commit | 6df57ef709f0a19e467a5a88bc854f4e5f8e00f7 (patch) | |
tree | 4bd64040d9d2a159d781d066f397edae74ad04f7 /web-ui/test/spec/user_settings/data | |
parent | 7524cb21facf3d739d29e312ffe85bda7377f261 (diff) |
Issue #411 - Fixed the tests [Gil/Jeff]
Diffstat (limited to 'web-ui/test/spec/user_settings/data')
-rw-r--r-- | web-ui/test/spec/user_settings/data/user_settings.spec.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/web-ui/test/spec/user_settings/data/user_settings.spec.js b/web-ui/test/spec/user_settings/data/user_settings.spec.js new file mode 100644 index 00000000..0fff7fae --- /dev/null +++ b/web-ui/test/spec/user_settings/data/user_settings.spec.js @@ -0,0 +1,28 @@ +describeComponent('user_settings/data/user_settings', function () { + 'use strict'; + + beforeEach(function () { + this.setupComponent(); + }); + + it('gets user info from the server', function() { + var data = {account_email: 'user@pixelated.org'}; + var deferred = $.Deferred(); + + spyOn($, 'ajax').and.returnValue(deferred); + this.component.getUserSettings(); + deferred.resolve(); + + expect($.ajax.calls.mostRecent().args[0]).toEqual('/user-settings'); + expect($.ajax.calls.mostRecent().args[1].type).toEqual('GET'); + }); + + it('send user info when event userSettings.getInfo is trigged', function() { + var data = {account_email: 'user@pixelated.org'}; + var eventSpy = spyOnEvent(document, Pixelated.events.userSettings.here); + + this.component.trigger(document, Pixelated.events.userSettings.getInfo); + + expect(eventSpy).toHaveBeenTriggeredOn(document); + }); +}); |