diff options
-rw-r--r-- | web-ui/app/js/tags/data/tags.js | 9 | ||||
-rw-r--r-- | web-ui/test/spec/tags/data/tags.spec.js | 12 |
2 files changed, 10 insertions, 11 deletions
diff --git a/web-ui/app/js/tags/data/tags.js b/web-ui/app/js/tags/data/tags.js index 348c1832..31703b2a 100644 --- a/web-ui/app/js/tags/data/tags.js +++ b/web-ui/app/js/tags/data/tags.js @@ -35,10 +35,10 @@ define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins }; function dataTags() { - function sendTagsBackTo(on, params) { + function sendTagsBackTo(on) { return function(data) { data.push(DataTags.all); - on.trigger(params.caller, events.tags.received, {tags: data}); + on.trigger(document, events.tags.received, {tags: data}); }; } @@ -48,11 +48,12 @@ define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins this.fetchTags = function(event, params) { monitoredAjax(this, this.attr.tagsResource) - .done(sendTagsBackTo(this, params)); + .done(sendTagsBackTo(this)); }; this.refreshTags = function() { - this.fetchTags(null, {caller: document}); + var notTriggeredByEvent = null; + this.fetchTags(notTriggeredByEvent); }; this.after('initialize', function () { diff --git a/web-ui/test/spec/tags/data/tags.spec.js b/web-ui/test/spec/tags/data/tags.spec.js index 53978fb8..7c4cd4e0 100644 --- a/web-ui/test/spec/tags/data/tags.spec.js +++ b/web-ui/test/spec/tags/data/tags.spec.js @@ -23,14 +23,13 @@ describeComponent('tags/data/tags', function () { var deferred = $.Deferred(); spyOn($, 'ajax').and.returnValue(deferred); - var me = {}; - var eventSpy = spyOnEvent(me, Pixelated.events.tags.received); + var eventSpy = spyOnEvent(document, Pixelated.events.tags.received); - this.component.trigger(Pixelated.events.tags.want, { caller: me}); + this.component.trigger(Pixelated.events.tags.want); deferred.resolve(['foo', 'bar', 'quux/bar']); - expect(eventSpy).toHaveBeenTriggeredOn(me); + expect(eventSpy).toHaveBeenTriggeredOn(document); }); it('triggers an event containing the returned tags', function() { @@ -38,9 +37,8 @@ describeComponent('tags/data/tags', function () { var deferred = $.Deferred(); spyOn($, 'ajax').and.returnValue(deferred); - var me = {}; - var eventSpy = spyOnEvent(me, Pixelated.events.tags.received); - this.component.trigger(Pixelated.events.tags.want, { caller: me }); + var eventSpy = spyOnEvent(document, Pixelated.events.tags.received); + this.component.trigger(Pixelated.events.tags.want); deferred.resolve(tags); |