From 3945e18176db929c758b03510c92b31c6da2bf3b Mon Sep 17 00:00:00 2001 From: Enrique Alcantara Date: Wed, 1 May 2019 08:56:23 -0400 Subject: [PATCH] CE-backport track uninstall button clicks --- .../uninstall_application_confirmation_modal.vue | 10 +++++++++- .../mixins/track_uninstall_button_click.js | 5 +++++ ...install_application_confirmation_modal_spec.js | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js diff --git a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue index 80ba2f22198..65827f1cb6a 100644 --- a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue +++ b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue @@ -1,6 +1,7 @@ diff --git a/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js b/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js new file mode 100644 index 00000000000..18f65b234d3 --- /dev/null +++ b/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js @@ -0,0 +1,5 @@ +export default { + methods: { + trackUninstallButtonClick: () => {}, + }, +}; diff --git a/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js index 6a7126b45cd..04808864fc0 100644 --- a/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js +++ b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js @@ -29,10 +29,19 @@ describe('UninstallApplicationConfirmationModal', () => { expect(wrapper.find(GlModal).attributes('ok-title')).toEqual(`Uninstall ${appTitle}`); }); - it('triggers confirm event when ok button is clicked', () => { - wrapper.find(GlModal).vm.$emit('ok'); + describe('when ok button is clicked', () => { + beforeEach(() => { + jest.spyOn(wrapper.vm, 'trackUninstallButtonClick'); + wrapper.find(GlModal).vm.$emit('ok'); + }); - expect(wrapper.emitted('confirm')).toBeTruthy(); + it('emits confirm event', () => { + expect(wrapper.emitted('confirm')).toBeTruthy(); + }); + + it('calls track uninstall button click mixin', () => { + expect(wrapper.vm.trackUninstallButtonClick).toHaveBeenCalledWith(INGRESS); + }); }); it('displays a warning text indicating the app will be uninstalled', () => {