blob: 0fff7fae5dfc7e1d5fe04e587a900b4a9b1771f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
});
});
|