Repository: ambari Updated Branches: refs/heads/branch-2.4 8c0ff6c8a -> 9a3cce9ef
AMBARI-17084. UI - EU "pause upgrade" button didn't work the first time (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a3cce9e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a3cce9e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a3cce9e Branch: refs/heads/branch-2.4 Commit: 9a3cce9efc99f99cc00cf632da5dd6c52b61284d Parents: 8c0ff6c Author: Alex Antonenko <[email protected]> Authored: Tue Jun 7 12:10:59 2016 +0300 Committer: Alex Antonenko <[email protected]> Committed: Tue Jun 7 14:31:21 2016 +0300 ---------------------------------------------------------------------- .../main/admin/stack_and_upgrade_controller.js | 1 + .../admin/stack_and_upgrade_controller_test.js | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9a3cce9e/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js index 84fee9e..20cfe40 100644 --- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js +++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js @@ -1603,6 +1603,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, * @return {App.ModalPopup} */ openUpgradeDialog: function () { + App.propertyDidChange('upgradeSuspended'); App.router.transitionTo('admin.stackUpgrade'); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/9a3cce9e/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js index a76148b..e547d73 100644 --- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js +++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js @@ -307,16 +307,26 @@ describe('App.MainAdminStackAndUpgradeController', function() { }); describe("#openUpgradeDialog()", function () { - before(function () { + var mock = { + observer: Em.K + }; + beforeEach(function () { sinon.stub(App.router, 'transitionTo', Em.K); + sinon.spy(mock, 'observer'); + Em.addObserver(App, 'upgradeSuspended', mock, 'observer'); + controller.openUpgradeDialog(); }); - after(function () { + afterEach(function () { App.router.transitionTo.restore(); + mock.observer.restore(); + Em.removeObserver(App, 'upgradeSuspended', mock, 'observer'); }); - it("should open dialog", function () { - controller.openUpgradeDialog(); + it('should open dialog', function () { expect(App.router.transitionTo.calledWith('admin.stackUpgrade')).to.be.true; }); + it('upgradeSuspended should receive actual value', function () { + expect(mock.observer.calledOnce).to.be.true; + }); }); describe("#runPreUpgradeCheck()", function() {
