ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [13/24] ambari git commit: AMBARI-14967. Incorrect behavior of period combobox/metrics on Dashboard page after resetting all widgets to default (alexantonenko)
Date Wed, 10 Feb 2016 16:13:10 GMT
AMBARI-14967. Incorrect behavior of period combobox/metrics on Dashboard page after resetting
all widgets to default (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cb3b3ed4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb3b3ed4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb3b3ed4

Branch: refs/heads/branch-dev-patch-upgrade
Commit: cb3b3ed444812fa34baf05222c21360ec7268c6a
Parents: f25dd31
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Feb 9 11:57:41 2016 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Feb 9 12:39:30 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/views/main/dashboard/widgets.js  |  5 +++
 .../test/views/main/dashboard/widgets_test.js   | 42 +++++++++++++++++---
 2 files changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb3b3ed4/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 95afba7..a2fb281 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -504,6 +504,11 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage,
Ap
         self.postUserPref(self.get('persistKey'), self.get('initPrefObject'));
         self.setDBProperty(self.get('persistKey'), self.get('initPrefObject'));
       }
+      self.setProperties({
+        currentTimeRangeIndex: 0,
+        customStartTime: null,
+        customEndTime: null
+      });
       self.translateToReal(self.get('initPrefObject'));
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb3b3ed4/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index ca0837a..49a06a4 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -449,16 +449,46 @@ describe('App.MainDashboardWidgetsView', function () {
   });
 
   describe("#resetAllWidgets()", function () {
-    before(function () {
-      sinon.stub(App, 'showConfirmationPopup', Em.K);
+
+    beforeEach(function () {
+      sinon.stub(App, 'showConfirmationPopup', Em.clb);
+      sinon.stub(view, 'postUserPref', Em.K);
+      sinon.stub(view, 'setDBProperty', Em.K);
+      sinon.stub(view, 'translateToReal', Em.K);
+      view.setProperties({
+        currentTimeRangeIndex: 1,
+        customStartTime: 1000,
+        customEndTime: 2000
+      });
+      view.resetAllWidgets();
     });
-    after(function () {
+
+    afterEach(function () {
       App.showConfirmationPopup.restore();
+      view.postUserPref.restore();
+      view.setDBProperty.restore();
+      view.translateToReal.restore();
     });
-    it("showConfirmationPopup is called once", function () {
-      view.resetAllWidgets();
-      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+
+    it('persist reset', function () {
+      expect(view.postUserPref.calledOnce).to.be.true;
+    });
+    it('local storage reset', function () {
+      expect(view.setDBProperty.calledOnce).to.be.true;
+    });
+    it('time range reset', function () {
+      expect(view.get('currentTimeRangeIndex')).to.equal(0);
     });
+    it('custom start time reset', function () {
+      expect(view.get('customStartTime')).to.be.null;
+    });
+    it('custom end time reset', function () {
+      expect(view.get('customEndTime')).to.be.null;
+    });
+    it('default settings application', function () {
+      expect(view.translateToReal.calledOnce).to.be.true;
+    });
+
   });
 
   describe('#checkServicesChange', function () {


Mime
View raw message