Skip to content

Commit

Permalink
Merge pull request #387 from aholachek/hide-recommender
Browse files Browse the repository at this point in the history
disabling recommender for now
  • Loading branch information
aholachek committed May 14, 2015
2 parents 4c4245e + 226eac4 commit f5cad1f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/js/page_managers/templates/toc-page-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div data-widget="ShowResources"/>
</div>
<div class="s-right-col-widget-container">
<div data-widget="ShowRecommender"/>
<!--<div data-widget="ShowRecommender"/>-->
</div>
<div class="s-right-col-widget-container">
<div data-widget="ShowGraphicsSidebar"/>
Expand Down
13 changes: 9 additions & 4 deletions src/js/widgets/recommender/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ define([
},

activate: function (beehive) {
this.pubsub = beehive.Services.get('PubSub');
_.bindAll(this, ['processResponse', 'onDisplayDocuments']);
this.pubsub.subscribe(this.pubsub.DISPLAY_DOCUMENTS, this.onDisplayDocuments);
this.pubsub.subscribe(this.pubsub.DELIVERING_RESPONSE, this.processResponse);

/*
* hiding this widget for now
* */
//
// this.pubsub = beehive.Services.get('PubSub');
// _.bindAll(this, ['processResponse', 'onDisplayDocuments']);
// this.pubsub.subscribe(this.pubsub.DISPLAY_DOCUMENTS, this.onDisplayDocuments);
// this.pubsub.subscribe(this.pubsub.DELIVERING_RESPONSE, this.processResponse);
},

onDisplayDocuments: function(apiQuery) {
Expand Down
48 changes: 24 additions & 24 deletions test/mocha/js/widgets/recommender_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,30 @@ define([
expect(apiRequest.toJSON().target).to.eql('recommender/fakeBibcode');
});

it("Communicates through pubsub", function() {
var minsub = new (MinPubSub.extend({
request: function(apiRequest) {
return JSON.parse(JSON.stringify(testData));
}

}))({verbose: false});

var widget = new RecommenderWidget();
var onDisplayDocuments = sinon.spy(widget, 'onDisplayDocuments');
var loadBibcodeData = sinon.spy(widget, 'loadBibcodeData');
var processResponse = sinon.spy(widget, 'processResponse');

widget.activate(minsub.beehive.getHardenedInstance());

minsub.publish(minsub.DISPLAY_DOCUMENTS, minsub.createQuery({'q': 'bibcode:foo'}));
expect(onDisplayDocuments.callCount).to.be.eql(1);
expect(loadBibcodeData.callCount).to.be.eql(1);
expect(loadBibcodeData.lastCall.args[0]).to.be.eql('foo');
expect(processResponse.callCount).to.be.eql(1);

expect(widget.collection.models.length).to.be.eql(7);

});
// it("Communicates through pubsub", function() {
// var minsub = new (MinPubSub.extend({
// request: function(apiRequest) {
// return JSON.parse(JSON.stringify(testData));
// }
//
// }))({verbose: false});
//
// var widget = new RecommenderWidget();
// var onDisplayDocuments = sinon.spy(widget, 'onDisplayDocuments');
// var loadBibcodeData = sinon.spy(widget, 'loadBibcodeData');
// var processResponse = sinon.spy(widget, 'processResponse');
//
// widget.activate(minsub.beehive.getHardenedInstance());
//
// minsub.publish(minsub.DISPLAY_DOCUMENTS, minsub.createQuery({'q': 'bibcode:foo'}));
// expect(onDisplayDocuments.callCount).to.be.eql(1);
// expect(loadBibcodeData.callCount).to.be.eql(1);
// expect(loadBibcodeData.lastCall.args[0]).to.be.eql('foo');
// expect(processResponse.callCount).to.be.eql(1);
//
// expect(widget.collection.models.length).to.be.eql(7);
//
// });

})
});

0 comments on commit f5cad1f

Please sign in to comment.