CSR-520 remove close modal gold plating
This commit is contained in:
parent
a8eb81f23c
commit
ea0613c913
5 changed files with 7 additions and 82 deletions
|
|
@ -17,7 +17,7 @@ jest.mock('@/assets/img/windshield.png', () => 'windshield.png')
|
|||
describe("loadingModal", () => {
|
||||
test("showModal sets modal visible", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ clickOutCloses: false });
|
||||
const { wrapper } = setupMocks();
|
||||
wrapper.vm.isModalVisible = false;
|
||||
|
||||
//Act
|
||||
|
|
@ -30,54 +30,7 @@ describe("loadingModal", () => {
|
|||
});
|
||||
|
||||
|
||||
describe("loadingModal", () => {
|
||||
test("closeModal sets modal not visible", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ clickOutCloses: false });
|
||||
wrapper.vm.isModalVisible = true;
|
||||
|
||||
//Act
|
||||
wrapper.vm.closeModal();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.isModalVisible).toEqual(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadingModal", () => {
|
||||
test("canClose calls closeModal", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ clickOutCloses: true });
|
||||
wrapper.vm.isModalVisible = true;
|
||||
|
||||
//Act
|
||||
wrapper.vm.canClose();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.isModalVisible).toEqual(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadingModal", () => {
|
||||
test("canClose does not call closeModal", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ clickOutCloses: false });
|
||||
wrapper.vm.isModalVisible = true;
|
||||
|
||||
//Act
|
||||
wrapper.vm.canClose();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.isModalVisible).toEqual(true);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({
|
||||
clickOutCloses
|
||||
}) {
|
||||
function setupMocks() {
|
||||
|
||||
//Mock store
|
||||
store.dispatch = jest.fn(() => {});
|
||||
|
|
@ -89,9 +42,6 @@ function setupMocks({
|
|||
},
|
||||
});
|
||||
|
||||
//Mock props
|
||||
mountOptions.propsData = { clickOutCloses: clickOutCloses };
|
||||
const wrapper = shallowMount(loadingModal, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<div v-show="isModalVisible" class="loading-modal-backdrop" v-on:click="canClose" @close="closeModal">
|
||||
<div v-show="isModalVisible" class="loading-modal-backdrop">
|
||||
<div class="loading-modal">
|
||||
<button v-if="showCloseButton" type="button" class="loading-modal-close" @click="closeModal">x</button>
|
||||
<section class="loading-modal-body">
|
||||
<div class="modal-icon-container text-center">
|
||||
<img class="loader-gif" alt="Loading" src="@/assets/img/loader.gif">
|
||||
|
|
@ -30,20 +29,10 @@
|
|||
isModalVisible: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
showCloseButton: {type: Boolean, default: false},
|
||||
clickOutCloses: {type: Boolean, default: false},
|
||||
},
|
||||
methods: {
|
||||
showModal() {
|
||||
this.isModalVisible = true;
|
||||
},
|
||||
closeModal() {
|
||||
this.isModalVisible = false;
|
||||
},
|
||||
canClose() {
|
||||
this.clickOutCloses ? this.closeModal() : null;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -88,20 +77,6 @@
|
|||
padding: 0 24px 0 24px;
|
||||
}
|
||||
|
||||
.loading-modal-close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: none;
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
color: $blue;
|
||||
background: transparent;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.modal-icon-container {
|
||||
position: relative;
|
||||
width: 75px;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
v-slot="{ meta }"
|
||||
autocomplete="off" >
|
||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||
<loadingModal :showCloseButton=false :clickOutCloses=false ref="loadingModal">
|
||||
<loadingModal ref="loadingModal">
|
||||
<template v-slot:body>
|
||||
Please wait...
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||
<loadingModal :showCloseButton=false :clickOutCloses=false ref="loadingModal">
|
||||
<loadingModal ref="loadingModal">
|
||||
<template v-slot:body>
|
||||
Please wait...
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
v-slot="{ meta }"
|
||||
>
|
||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||
<loadingModal :showCloseButton=false :clickOutCloses=false ref="loadingModal">
|
||||
<loadingModal ref="loadingModal">
|
||||
<template v-slot:body>
|
||||
Please wait...
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in a new issue