From 5a7b8666ca718548cbe1c0bfe82190af6cf3bd57 Mon Sep 17 00:00:00 2001 From: Enrique Alcantara Date: Tue, 16 Apr 2019 10:56:07 -0400 Subject: Show uninstall button when app is uninstallable - Create empty uninstall_button component. - Add uninstallable property to application_row component. - Display Uninstall button if app is uninstallable and it is installed. --- .../clusters/components/application_row_spec.js | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'spec/frontend/clusters') diff --git a/spec/frontend/clusters/components/application_row_spec.js b/spec/frontend/clusters/components/application_row_spec.js index 1e4e814b5e1..038d2be9e98 100644 --- a/spec/frontend/clusters/components/application_row_spec.js +++ b/spec/frontend/clusters/components/application_row_spec.js @@ -114,11 +114,12 @@ describe('Application Row', () => { expect(vm.installButtonDisabled).toEqual(true); }); - it('has disabled "Installed" when application is installed', () => { + it('has disabled "Installed" when application is installed and not uninstallable', () => { vm = mountComponent(ApplicationRow, { ...DEFAULT_APPLICATION_STATE, status: APPLICATION_STATUS.INSTALLED, installed: true, + uninstallable: false, }); expect(vm.installButtonLabel).toEqual('Installed'); @@ -126,6 +127,18 @@ describe('Application Row', () => { expect(vm.installButtonDisabled).toEqual(true); }); + it('hides when application is installed and uninstallable', () => { + vm = mountComponent(ApplicationRow, { + ...DEFAULT_APPLICATION_STATE, + status: APPLICATION_STATUS.INSTALLED, + installed: true, + uninstallable: true, + }); + const installBtn = vm.$el.querySelector('.js-cluster-application-install-button'); + + expect(installBtn).toBe(null); + }); + it('has enabled "Install" when APPLICATION_STATUS.ERROR', () => { vm = mountComponent(ApplicationRow, { ...DEFAULT_APPLICATION_STATE, @@ -198,6 +211,19 @@ describe('Application Row', () => { }); }); + describe('Uninstall button', () => { + it('displays button when app is installed and uninstallable', () => { + vm = mountComponent(ApplicationRow, { + ...DEFAULT_APPLICATION_STATE, + installed: true, + uninstallable: true, + }); + const uninstallButton = vm.$el.querySelector('.js-cluster-application-uninstall-button'); + + expect(uninstallButton).toBeTruthy(); + }); + }); + describe('Upgrade button', () => { it('has indeterminate state on page load', () => { vm = mountComponent(ApplicationRow, { -- cgit v1.2.3