From 226eac4a242d7d4527f6f00385c9067bc41a27d2 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 14 May 2015 11:43:01 -0400 Subject: [PATCH] disabling recommender for now --- .../templates/toc-page-layout.html | 2 +- src/js/widgets/recommender/widget.js | 13 +++-- .../js/widgets/recommender_widget.spec.js | 48 +++++++++---------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/js/page_managers/templates/toc-page-layout.html b/src/js/page_managers/templates/toc-page-layout.html index 7b0fad5dd..a74a61dd1 100644 --- a/src/js/page_managers/templates/toc-page-layout.html +++ b/src/js/page_managers/templates/toc-page-layout.html @@ -53,7 +53,7 @@
-
+
diff --git a/src/js/widgets/recommender/widget.js b/src/js/widgets/recommender/widget.js index 7a2e45a1a..afc67c7d2 100644 --- a/src/js/widgets/recommender/widget.js +++ b/src/js/widgets/recommender/widget.js @@ -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) { diff --git a/test/mocha/js/widgets/recommender_widget.spec.js b/test/mocha/js/widgets/recommender_widget.spec.js index 2d2a9c8fa..8fc1b8efc 100644 --- a/test/mocha/js/widgets/recommender_widget.spec.js +++ b/test/mocha/js/widgets/recommender_widget.spec.js @@ -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); +// +// }); }) }); \ No newline at end of file