Repository: ambari Updated Branches: refs/heads/branch-2.5 439da8bd0 -> 37b5f2323
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/37b5f232 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/37b5f232 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/37b5f232 Branch: refs/heads/branch-2.5 Commit: 37b5f2323375242846364b3979a563a1a20f2d5d Parents: 439da8b Author: Andrii Tkach <[email protected]> Authored: Mon Jul 24 18:35:48 2017 +0300 Committer: Andrii Tkach <[email protected]> Committed: Tue Jul 25 12:34:04 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/37b5f232/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 bfabc02..3e74f23 100644 --- a/ambari-web/app/views/wizard/step1_view.js +++ b/ambari-web/app/views/wizard/step1_view.js @@ -197,10 +197,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('[email protected]', '[email protected]', 'controller.selectedStack.useRedhatSatellite'), http://git-wip-us.apache.org/repos/asf/ambari/blob/37b5f232/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 1eceab1..84957a9 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 () { @@ -55,4 +57,48 @@ describe('App.WizardStep1View', function () { expect(repository.get('validation')).to.be.empty; }); }); + + 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
