diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 09:21:40 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 09:21:40 +0300 |
commit | 9642a472b67d46c230adf15ece8e79c850af99e4 (patch) | |
tree | e7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/notes_spec.js | |
parent | 28d412e5b2b8499fba22e8fabb1d44f44449228e (diff) | |
parent | 6f5723a169b5d400c136dbd844fc54c68e5f8563 (diff) |
Merge branch '51712-new-line-before-expect' into 'master'
3. enable jasmine/new-line-before-expect
See merge request gitlab-org/gitlab-ce!22234
Diffstat (limited to 'spec/javascripts/notes_spec.js')
-rw-r--r-- | spec/javascripts/notes_spec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index 7bfbca83c77..259b9746fe3 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -123,9 +123,11 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; it('autosizes after comment submission', function() { $(textarea).text('This is an example comment note'); + expect(this.autoSizeSpy).not.toHaveBeenTriggered(); $('.js-comment-button').click(); + expect(this.autoSizeSpy).toHaveBeenTriggered(); }); @@ -136,6 +138,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; deferred.reject(); $('.js-comment-button').click(); + expect($(textarea).val()).toEqual('A comment with `markup`.'); }); }); @@ -538,6 +541,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; mockNotesPost(); $('.js-comment-button').click(); + expect($notesContainer.find('.note.being-posted').length).toBeGreaterThan(0); }); @@ -556,6 +560,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; describe('postComment', () => { it('disables the submit button', done => { const $submitButton = $form.find('.js-comment-submit-button'); + expect($submitButton).not.toBeDisabled(); const dummyEvent = { preventDefault() {}, @@ -637,6 +642,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; .then(timeoutPromise) .then(() => { const $updatedNoteEl = $notesContainer.find(`#note_${note.id}`); + expect($updatedNoteEl.hasClass('.being-posted')).toEqual(false); // Remove being-posted visuals expect( $updatedNoteEl @@ -644,6 +650,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; .text() .trim(), ).toEqual(sampleComment); // See if comment reverted back to original + expect($('.flash-container').is(':visible')).toEqual(true); // Flash error message shown done(); @@ -749,6 +756,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; const $updatedNoteEl = $notesContainer .find(`#note_${note.id}`) .find('.js-task-list-container'); + expect( $updatedNoteEl .find('.note-text') @@ -860,6 +868,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; it('should return executing quick action description when note has single quick action', () => { const sampleComment = '/close'; + expect(this.notes.getQuickActionDescription(sampleComment, availableQuickActions)).toBe( 'Applying command to close this issue', ); @@ -867,6 +876,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; it('should return generic multiple quick action description when note has multiple quick actions', () => { const sampleComment = '/close\n/title [Duplicate] Issue foobar'; + expect(this.notes.getQuickActionDescription(sampleComment, availableQuickActions)).toBe( 'Applying multiple commands', ); @@ -874,6 +884,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; it('should return generic quick action description when available quick actions list is not populated', () => { const sampleComment = '/close\n/title [Duplicate] Issue foobar'; + expect(this.notes.getQuickActionDescription(sampleComment)).toBe('Applying command'); }); }); @@ -907,6 +918,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; $tempNote.find('.timeline-icon > a, .note-header-info > a').each(function() { expect($(this).attr('href')).toEqual(`/${currentUsername}`); }); + expect($tempNote.find('.timeline-icon .avatar').attr('src')).toEqual(currentUserAvatar); expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeFalsy(); expect( @@ -915,12 +927,14 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; .text() .trim(), ).toEqual(currentUserFullname); + expect( $tempNoteHeader .find('.note-headline-light') .text() .trim(), ).toEqual(`@${currentUsername}`); + expect( $tempNote .find('.note-body .note-text p') @@ -953,6 +967,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper'; currentUserAvatar, }); const $tempNoteHeader = $tempNote.find('.note-header'); + expect( $tempNoteHeader .find('.d-none.d-sm-inline-block') |