ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-20478 Unable to load UI after enabling some experimental features. (ababiichuk)
Date Fri, 17 Mar 2017 11:22:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 03276d20a -> ee05c9440


AMBARI-20478 Unable to load UI after enabling some experimental features. (ababiichuk)


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

Branch: refs/heads/branch-2.5
Commit: ee05c94404dfb2c9ff6799d264febdbb0b711634
Parents: 03276d2
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Thu Mar 16 12:17:46 2017 +0200
Committer: ababiichuk <ababiichuk@hortonworks.com>
Committed: Fri Mar 17 13:21:14 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/experimental.js      |  4 +--
 .../test/controllers/experimental_test.js       | 32 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ee05c944/ambari-web/app/controllers/experimental.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/experimental.js b/ambari-web/app/controllers/experimental.js
index da8f39d..bf5c529 100644
--- a/ambari-web/app/controllers/experimental.js
+++ b/ambari-web/app/controllers/experimental.js
@@ -33,9 +33,9 @@ App.ExperimentalController = Em.Controller.extend(App.UserPref, {
     return this.getUserPref('user-pref-' + App.router.get('loginName') + '-supports');
   },
 
-  getUserPrefSuccessCallback: function (response, request, data) {
+  getUserPrefSuccessCallback: function (response) {
     if (response) {
-      App.set('supports', $.extend(App.get('supports'), response));
+      App.set('supports', $.extend({}, App.get('supports'), response));
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ee05c944/ambari-web/test/controllers/experimental_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/experimental_test.js b/ambari-web/test/controllers/experimental_test.js
index 0ff0758..c3fcf18 100644
--- a/ambari-web/test/controllers/experimental_test.js
+++ b/ambari-web/test/controllers/experimental_test.js
@@ -86,4 +86,36 @@ describe('App.ExperimentalController', function () {
 
   });
 
+  describe('#getUserPrefSuccessCallback', function () {
+
+    var receivedSupports = {
+        sup0: false,
+        sup2: true
+      },
+      expectedResult = {
+        sup0: false,
+        sup1: false,
+        sup2: true
+      };
+
+    beforeEach(function () {
+      sinon.spy(App, 'set');
+    });
+
+    afterEach(function () {
+      App.set.restore();
+    });
+
+    it('no data received', function () {
+      controller.getUserPrefSuccessCallback(null);
+      expect(App.set.called).to.be.false;
+    });
+
+    it('some data received', function () {
+      controller.getUserPrefSuccessCallback(receivedSupports);
+      expect(App.set.calledWith('supports', expectedResult)).to.be.true;
+    });
+
+  });
+
 });


Mime
View raw message