summaryrefslogtreecommitdiff
path: root/spec/javascripts/issue_show/components/description_spec.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-12-11 11:35:57 +0000
committerPhil Hughes <me@iamphill.com>2017-12-11 11:35:57 +0000
commita5d2732ce91e24fbb7ea8c9b087ba3c7476edc09 (patch)
tree551c1d8a8f1b85f426324519e4a74bf4c71eba88 /spec/javascripts/issue_show/components/description_spec.js
parente4bae9118c79c95d16ab634210907e06278c6854 (diff)
parent689bc9ea6db102006b548e6176125157955c7f2b (diff)
downloadgitlab-ce-a5d2732ce91e24fbb7ea8c9b087ba3c7476edc09.tar.gz
Merge branch 'master' into 'url-utility-es-module'
# Conflicts: # app/assets/javascripts/issue_show/components/app.vue
Diffstat (limited to 'spec/javascripts/issue_show/components/description_spec.js')
-rw-r--r--spec/javascripts/issue_show/components/description_spec.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/javascripts/issue_show/components/description_spec.js b/spec/javascripts/issue_show/components/description_spec.js
index 163e5cdd062..2e000a1063f 100644
--- a/spec/javascripts/issue_show/components/description_spec.js
+++ b/spec/javascripts/issue_show/components/description_spec.js
@@ -51,6 +51,35 @@ describe('Description component', () => {
});
});
+ it('opens recaptcha dialog if update rejected as spam', (done) => {
+ let modal;
+ const recaptchaChild = vm.$children
+ .find(child => child.$options._componentTag === 'recaptcha-dialog'); // eslint-disable-line no-underscore-dangle
+
+ recaptchaChild.scriptSrc = '//scriptsrc';
+
+ vm.taskListUpdateSuccess({
+ recaptcha_html: '<div class="g-recaptcha">recaptcha_html</div>',
+ });
+
+ vm.$nextTick()
+ .then(() => {
+ modal = vm.$el.querySelector('.js-recaptcha-dialog');
+
+ expect(modal.style.display).not.toEqual('none');
+ expect(modal.querySelector('.g-recaptcha').textContent).toEqual('recaptcha_html');
+ expect(document.body.querySelector('.js-recaptcha-script').src).toMatch('//scriptsrc');
+ })
+ .then(() => modal.querySelector('.close').click())
+ .then(() => vm.$nextTick())
+ .then(() => {
+ expect(modal.style.display).toEqual('none');
+ expect(document.body.querySelector('.js-recaptcha-script')).toBeNull();
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+
describe('TaskList', () => {
beforeEach(() => {
vm = mountComponent(DescriptionComponent, Object.assign({}, props, {
@@ -86,6 +115,7 @@ describe('Description component', () => {
dataType: 'issuableType',
fieldName: 'description',
selector: '.detail-page-description',
+ onSuccess: jasmine.any(Function),
});
done();
});