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/b7d5e013
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b7d5e013
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b7d5e013

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: b7d5e013ec24a3fad2c086bf3cdd960220685966
Parents: 9600918
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Thu Mar 16 12:17:46 2017 +0200
Committer: ababiichuk <ababiic...@hortonworks.com>
Committed: Thu Mar 16 12:17:46 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/b7d5e013/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/b7d5e013/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;
+    });
+
+  });
+
 });

Reply via email to