Commit 006bc124 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winh-prevent-multiple-recaptcha-modals' into 'master'

Throw error for multiple RecaptchaModal instances

See merge request gitlab-org/gitlab-ce!32017
parents 976f0dfa a28c77f2
...@@ -30,9 +30,16 @@ export default { ...@@ -30,9 +30,16 @@ export default {
}, },
mounted() { mounted() {
if (window.recaptchaDialogCallback) {
throw new Error('recaptchaDialogCallback is already defined!');
}
window.recaptchaDialogCallback = this.submit.bind(this); window.recaptchaDialogCallback = this.submit.bind(this);
}, },
beforeDestroy() {
window.recaptchaDialogCallback = null;
},
methods: { methods: {
appendRecaptchaScript() { appendRecaptchaScript() {
this.removeRecaptchaScript(); this.removeRecaptchaScript();
......
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import '~/behaviors/markdown/render_gfm';
import Description from '~/issue_show/components/description.vue'; import Description from '~/issue_show/components/description.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
...@@ -91,6 +92,7 @@ describe('Description component', () => { ...@@ -91,6 +92,7 @@ describe('Description component', () => {
let TaskList; let TaskList;
beforeEach(() => { beforeEach(() => {
vm.$destroy();
vm = mountComponent( vm = mountComponent(
DescriptionComponent, DescriptionComponent,
Object.assign({}, props, { Object.assign({}, props, {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment