Skip to content
Snippets Groups Projects
Verified Commit 556ef5ed authored by Phil Hughes's avatar Phil Hughes
Browse files

spec fixes

parent 44d3745e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,9 +32,9 @@ export default class GlFieldErrors {
const $form = $(e.currentTarget);
 
if (!$form.attr('novalidate')) {
if (!event.currentTarget.checkValidity()) {
event.preventDefault();
event.stopPropagation();
if (!e.currentTarget.checkValidity()) {
e.preventDefault();
e.stopPropagation();
}
}
}
Loading
Loading
Loading
Loading
@@ -558,7 +558,7 @@ export default class Notes {
*/
setupNoteForm(form) {
var textarea, key;
new GLForm(form, this.enableGFM);
this.glForm = new GLForm(form, this.enableGFM);
textarea = form.find('.js-note-text');
key = [
'Note',
Loading
Loading
@@ -1153,7 +1153,7 @@ export default class Notes {
var targetId = $originalContentEl.data('target-id');
var targetType = $originalContentEl.data('target-type');
 
new GLForm($editForm.find('form'), this.enableGFM);
this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
 
$editForm.find('form')
.attr('action', postUrl)
Loading
Loading
import autosize from 'vendor/autosize';
import '~/gl_form';
import GLForm from '~/gl_form';
import '~/lib/utils/text_utility';
import '~/lib/utils/common_utils';
 
window.autosize = autosize;
 
describe('GLForm', () => {
const global = window.gl || (window.gl = {});
const GLForm = global.GLForm;
it('should be defined in the global scope', () => {
expect(GLForm).toBeDefined();
});
describe('when instantiated', function () {
beforeEach((done) => {
this.form = $('<form class="gfm-form"><textarea class="js-gfm-input"></form>');
Loading
Loading
Loading
Loading
@@ -426,19 +426,17 @@ import '~/notes';
});
 
describe('putEditFormInPlace', () => {
it('should call gl.GLForm with GFM parameter passed through', () => {
spyOn(gl, 'GLForm');
it('should call GLForm with GFM parameter passed through', () => {
const notes = new Notes('', []);
const $el = $(`
<div>
<form></form>
</div>
`);
 
const $el = jasmine.createSpyObj('$form', ['find', 'closest']);
$el.find.and.returnValue($('<div>'));
$el.closest.and.returnValue($('<div>'));
notes.putEditFormInPlace($el);
 
Notes.prototype.putEditFormInPlace.call({
getEditFormSelector: () => '',
enableGFM: true
}, $el);
expect(gl.GLForm).toHaveBeenCalledWith(jasmine.any(Object), true);
expect(notes.glForm.enableGFM).toBeTruthy();
});
});
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment