diff options
Diffstat (limited to 'spec/frontend/gl_form_spec.js')
-rw-r--r-- | spec/frontend/gl_form_spec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/gl_form_spec.js b/spec/frontend/gl_form_spec.js index 150d8a053d5..52e1693f8a6 100644 --- a/spec/frontend/gl_form_spec.js +++ b/spec/frontend/gl_form_spec.js @@ -9,6 +9,8 @@ describe('GLForm', () => { describe('when instantiated', () => { beforeEach(done => { + window.gl = window.gl || {}; + testContext.form = $('<form class="gfm-form"><textarea class="js-gfm-input"></form>'); testContext.textarea = testContext.form.find('textarea'); jest.spyOn($.prototype, 'off').mockReturnValue(testContext.textarea); @@ -111,5 +113,21 @@ describe('GLForm', () => { expect(autosize.destroy).not.toHaveBeenCalled(); }); }); + + describe('supportsQuickActions', () => { + it('should return false if textarea does not support quick actions', () => { + const glForm = new GLForm(testContext.form, false); + + expect(glForm.supportsQuickActions).toEqual(false); + }); + + it('should return true if textarea supports quick actions', () => { + testContext.textarea.attr('data-supports-quick-actions', true); + + const glForm = new GLForm(testContext.form, false); + + expect(glForm.supportsQuickActions).toEqual(true); + }); + }); }); }); |