Repository: ambari Updated Branches: refs/heads/trunk 9715bc9ff -> 6bc7c69eb
AMBARI-8819 Unit tests for dashboard views (additional patch). (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6bc7c69e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6bc7c69e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6bc7c69e Branch: refs/heads/trunk Commit: 6bc7c69ebb8242ce9caf2f05b5e22711c6236270 Parents: 9715bc9 Author: Andrii Tkach <[email protected]> Authored: Mon Dec 22 17:56:31 2014 +0200 Committer: Andrii Tkach <[email protected]> Committed: Mon Dec 22 18:03:03 2014 +0200 ---------------------------------------------------------------------- .../app/views/main/dashboard/config_history_view.js | 4 +++- ambari-web/test/views/main/dashboard/widget_test.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6bc7c69e/ambari-web/app/views/main/dashboard/config_history_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js index bb7f8ae..bd3c2db 100644 --- a/ambari-web/app/views/main/dashboard/config_history_view.js +++ b/ambari-web/app/views/main/dashboard/config_history_view.js @@ -190,7 +190,9 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, { refresh: function () { var self = this; this.set('filteringComplete', false); - this.get('controller').load().done(this.refreshDone); + this.get('controller').load().done(function () { + self.refreshDone.apply(self); + }); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/6bc7c69e/ambari-web/test/views/main/dashboard/widget_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/widget_test.js b/ambari-web/test/views/main/dashboard/widget_test.js index dab6b30..b0c249c 100644 --- a/ambari-web/test/views/main/dashboard/widget_test.js +++ b/ambari-web/test/views/main/dashboard/widget_test.js @@ -140,24 +140,28 @@ describe('App.DashboardWidgetView', function () { describe("#showEditDialog()", function () { var obj = Em.Object.create({ - observeNewThresholdValue: Em.K, + observeThresh1Value: Em.K, + observeThresh2Value: Em.K, thresh1: '1', thresh2: '2' }); before(function () { - sinon.spy(obj, 'observeNewThresholdValue'); + sinon.spy(obj, 'observeThresh1Value'); + sinon.spy(obj, 'observeThresh2Value'); sinon.stub(dashboardWidgetView.get('parentView'), 'getUserPref').returns({ complete: Em.K }); }); after(function () { - obj.observeNewThresholdValue.restore(); + obj.observeThresh1Value.restore(); + obj.observeThresh2Value.restore(); dashboardWidgetView.get('parentView').getUserPref.restore(); }); it("open popup", function () { var popup = dashboardWidgetView.showEditDialog(obj); popup.onPrimary(); - expect(obj.observeNewThresholdValue.calledOnce).to.be.true; + expect(obj.observeThresh1Value.calledOnce).to.be.true; + expect(obj.observeThresh2Value.calledOnce).to.be.true; expect(dashboardWidgetView.get('thresh1')).to.equal(1); expect(dashboardWidgetView.get('thresh2')).to.equal(2); expect(dashboardWidgetView.get('parentView').getUserPref.calledOnce).to.be.true;
