Repository: ambari
Updated Branches:
  refs/heads/trunk cdefd5825 -> a4ce7b865


AMBARI-21564 Select version page load failed on cluster installation. (atkach)


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

Branch: refs/heads/trunk
Commit: a4ce7b86577d0c1a985d2018f7a1876fa6058009
Parents: cdefd58
Author: Andrii Tkach <atk...@apache.org>
Authored: Mon Jul 24 18:35:48 2017 +0300
Committer: Andrii Tkach <atk...@apache.org>
Committed: Tue Jul 25 12:44:21 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/views/wizard/step1_view.js       |  4 +-
 ambari-web/test/views/wizard/step1_view_test.js | 48 +++++++++++++++++++-
 2 files changed, 49 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a4ce7b86/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js 
b/ambari-web/app/views/wizard/step1_view.js
index 584f621..9ab4fde 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -202,10 +202,10 @@ App.WizardStep1View = Em.View.extend({
    * @type {bool}
    */
   isNoOsFilled: function () {
-    if (this.get('controller.selectedStack.useRedhatSatellite')) {
+    var operatingSystems = 
this.get('controller.selectedStack.operatingSystems');
+    if (this.get('controller.selectedStack.useRedhatSatellite') || 
Em.isNone(operatingSystems)) {
       return false;
     }
-    var operatingSystems = 
this.get('controller.selectedStack.operatingSystems');
     var selectedOS = operatingSystems.filterProperty('isSelected', true);
     return selectedOS.everyProperty('isNotFilled', true);
   }.property('controller.selectedStack.operatingSystems.@each.isSelected', 
'controller.selectedStack.operatingSystems.@each.isNotFilled', 
'controller.selectedStack.useRedhatSatellite'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/a4ce7b86/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js 
b/ambari-web/test/views/wizard/step1_view_test.js
index 8ed1b47..edf8e0c 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -22,7 +22,9 @@ require('views/wizard/step1_view');
 var view;
 
 function getView() {
-  return App.WizardStep1View.create();
+  return App.WizardStep1View.create({
+    controller: Em.Object.create()
+  });
 }
 
 describe('App.WizardStep1View', function () {
@@ -63,4 +65,48 @@ describe('App.WizardStep1View', function () {
       expect(repository.get('validation')).to.equal('PENDING');
     });
   });
+
+  describe('#isNoOsFilled', function() {
+
+    it('should be false when useRedhatSatellite is true', function() {
+      view.set('controller.selectedStack', Em.Object.create({
+        useRedhatSatellite: true
+      }));
+      expect(view.get('isNoOsFilled')).to.be.false;
+    });
+
+    it('should be false when operatingSystems is null', function() {
+      view.set('controller.selectedStack', Em.Object.create({
+        useRedhatSatellite: false,
+        operatingSystems: null
+      }));
+      expect(view.get('isNoOsFilled')).to.be.false;
+    });
+
+    it('should be false when operatingSystem is filled', function() {
+      view.set('controller.selectedStack', Em.Object.create({
+        useRedhatSatellite: false,
+        operatingSystems: [
+          Em.Object.create({
+            isSelected: true,
+            isNotFilled: false
+          })
+        ]
+      }));
+      expect(view.get('isNoOsFilled')).to.be.false;
+    });
+
+    it('should be true when operatingSystem is not filled', function() {
+      view.set('controller.selectedStack', Em.Object.create({
+        useRedhatSatellite: false,
+        operatingSystems: [
+          Em.Object.create({
+            isSelected: true,
+            isNotFilled: true
+          })
+        ]
+      }));
+      expect(view.get('isNoOsFilled')).to.be.true;
+    });
+  });
 });
\ No newline at end of file

Reply via email to