Throw error for multiple RecaptchaModal instances

This commit is contained in:
Winnie Hellmann 2019-08-21 08:06:50 +00:00 committed by Kushal Pandya
parent 976f0dfaf6
commit a28c77f2ad
2 changed files with 9 additions and 0 deletions

View File

@ -30,9 +30,16 @@ export default {
},
mounted() {
if (window.recaptchaDialogCallback) {
throw new Error('recaptchaDialogCallback is already defined!');
}
window.recaptchaDialogCallback = this.submit.bind(this);
},
beforeDestroy() {
window.recaptchaDialogCallback = null;
},
methods: {
appendRecaptchaScript() {
this.removeRecaptchaScript();

View File

@ -1,5 +1,6 @@
import $ from 'jquery';
import Vue from 'vue';
import '~/behaviors/markdown/render_gfm';
import Description from '~/issue_show/components/description.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
@ -91,6 +92,7 @@ describe('Description component', () => {
let TaskList;
beforeEach(() => {
vm.$destroy();
vm = mountComponent(
DescriptionComponent,
Object.assign({}, props, {