summaryrefslogtreecommitdiff
path: root/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js
diff options
context:
space:
mode:
authorEnrique Alcántara <ealcantara@gitlab.com>2019-05-02 14:17:03 +0000
committerPhil Hughes <me@iamphill.com>2019-05-02 14:17:03 +0000
commitbf229a6c632709ef7c69a7033eadfd74f5ddcc97 (patch)
tree876b70f0ddb0e111199a685dd53fb71adeba5552 /spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js
parentd6aa8a0553e30ef2d0d303fc79515cd5cf3ba1b9 (diff)
downloadgitlab-ce-bf229a6c632709ef7c69a7033eadfd74f5ddcc97.tar.gz
Uninstall application confirm modal component
- Vue confirmation modal implementation - CSS tweaks for modal default height
Diffstat (limited to 'spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js')
-rw-r--r--spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js
new file mode 100644
index 00000000000..6a7126b45cd
--- /dev/null
+++ b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js
@@ -0,0 +1,47 @@
+import { shallowMount } from '@vue/test-utils';
+import UninstallApplicationConfirmationModal from '~/clusters/components/uninstall_application_confirmation_modal.vue';
+import { GlModal } from '@gitlab/ui';
+import { INGRESS } from '~/clusters/constants';
+
+describe('UninstallApplicationConfirmationModal', () => {
+ let wrapper;
+ const appTitle = 'Ingress';
+
+ const createComponent = (props = {}) => {
+ wrapper = shallowMount(UninstallApplicationConfirmationModal, {
+ propsData: { ...props },
+ });
+ };
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ beforeEach(() => {
+ createComponent({ application: INGRESS, applicationTitle: appTitle });
+ });
+
+ it(`renders a modal with a title "Uninstall ${appTitle}"`, () => {
+ expect(wrapper.find(GlModal).attributes('title')).toEqual(`Uninstall ${appTitle}`);
+ });
+
+ it(`renders a modal with an ok button labeled "Uninstall ${appTitle}"`, () => {
+ 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');
+
+ expect(wrapper.emitted('confirm')).toBeTruthy();
+ });
+
+ it('displays a warning text indicating the app will be uninstalled', () => {
+ expect(wrapper.text()).toContain(`You are about to uninstall ${appTitle} from your cluster.`);
+ });
+
+ it('displays a custom warning text depending on the application', () => {
+ expect(wrapper.text()).toContain(
+ `The associated load balancer and IP will be deleted and cannot be restored.`,
+ );
+ });
+});