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", () => {
|
describe("loadingModal", () => {
|
||||||
test("showModal sets modal visible", async () => {
|
test("showModal sets modal visible", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ clickOutCloses: false });
|
const { wrapper } = setupMocks();
|
||||||
wrapper.vm.isModalVisible = false;
|
wrapper.vm.isModalVisible = false;
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
|
@ -30,54 +30,7 @@ describe("loadingModal", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("loadingModal", () => {
|
function setupMocks() {
|
||||||
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
|
|
||||||
}) {
|
|
||||||
|
|
||||||
//Mock store
|
//Mock store
|
||||||
store.dispatch = jest.fn(() => {});
|
store.dispatch = jest.fn(() => {});
|
||||||
|
|
@ -89,9 +42,6 @@ function setupMocks({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
//Mock props
|
|
||||||
mountOptions.propsData = { clickOutCloses: clickOutCloses };
|
|
||||||
const wrapper = shallowMount(loadingModal, mountOptions);
|
const wrapper = shallowMount(loadingModal, mountOptions);
|
||||||
|
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<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">
|
<div class="loading-modal">
|
||||||
<button v-if="showCloseButton" type="button" class="loading-modal-close" @click="closeModal">x</button>
|
|
||||||
<section class="loading-modal-body">
|
<section class="loading-modal-body">
|
||||||
<div class="modal-icon-container text-center">
|
<div class="modal-icon-container text-center">
|
||||||
<img class="loader-gif" alt="Loading" src="@/assets/img/loader.gif">
|
<img class="loader-gif" alt="Loading" src="@/assets/img/loader.gif">
|
||||||
|
|
@ -30,20 +29,10 @@
|
||||||
isModalVisible: false,
|
isModalVisible: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
|
||||||
showCloseButton: {type: Boolean, default: false},
|
|
||||||
clickOutCloses: {type: Boolean, default: false},
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
showModal() {
|
showModal() {
|
||||||
this.isModalVisible = true;
|
this.isModalVisible = true;
|
||||||
},
|
},
|
||||||
closeModal() {
|
|
||||||
this.isModalVisible = false;
|
|
||||||
},
|
|
||||||
canClose() {
|
|
||||||
this.clickOutCloses ? this.closeModal() : null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -88,20 +77,6 @@
|
||||||
padding: 0 24px 0 24px;
|
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 {
|
.modal-icon-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 75px;
|
width: 75px;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
autocomplete="off" >
|
autocomplete="off" >
|
||||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
<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>
|
<template v-slot:body>
|
||||||
Please wait...
|
Please wait...
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
<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">
|
<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>
|
<template v-slot:body>
|
||||||
Please wait...
|
Please wait...
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
>
|
>
|
||||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
<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>
|
<template v-slot:body>
|
||||||
Please wait...
|
Please wait...
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue