diff options
| author | kushalpandya <kushal@gitlab.com> | 2017-05-11 01:03:50 +0530 |
|---|---|---|
| committer | kushalpandya <kushal@gitlab.com> | 2017-05-12 19:35:35 +0530 |
| commit | b496674f90911de017f188ebd4fb6321b2f45e5a (patch) | |
| tree | 17d9362ee7006db4989586aeec5b9f72e47a4c54 | |
| parent | 2834362d8bd59583a56d3e5009db1c20fe071c28 (diff) | |
| download | gitlab-ce-b496674f90911de017f188ebd4fb6321b2f45e5a.tar.gz | |
Update tests for new UI of temporary system notes
| -rw-r--r-- | spec/javascripts/notes_spec.js | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index fb2ca435ba4..0c4cd07134f 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -394,28 +394,32 @@ import '~/notes'; const sampleComment = '/close'; const generatedPlaceholderNote = this.notes.generatePlaceholderNoteContent(sampleComment, availableSlashCommands); - expect(generatedPlaceholderNote).toBe("<i>Executing command 'Close this issue'</i>"); + expect(generatedPlaceholderNote.systemNote).toBeTruthy(); + expect(generatedPlaceholderNote.content).toBe('Applying command to close this issue'); }); it('should return generic slash command execution message when note has multiple slash commands', () => { const sampleComment = '/title Commenting issue \n /estimate 2d'; const generatedPlaceholderNote = this.notes.generatePlaceholderNoteContent(sampleComment, availableSlashCommands); - expect(generatedPlaceholderNote).toBe('<i>Executing multiple slash commands</i>'); + expect(generatedPlaceholderNote.systemNote).toBeTruthy(); + expect(generatedPlaceholderNote.content).toBe('Applying multiple commands'); }); it('should return message as it is when slash command is not written correctly', () => { const sampleComment = '/estimated 2d'; const generatedPlaceholderNote = this.notes.generatePlaceholderNoteContent(sampleComment, availableSlashCommands); - expect(generatedPlaceholderNote).toBe(sampleComment); + expect(generatedPlaceholderNote.systemNote).toBeFalsy(); + expect(generatedPlaceholderNote.content).toBe(sampleComment); }); it('should return message as it is when available slash commands list is not available', () => { const sampleComment = 'Ok, that seems doable. /estimate 2d'; const generatedPlaceholderNote = this.notes.generatePlaceholderNoteContent(sampleComment); - expect(generatedPlaceholderNote).toBe(sampleComment); + expect(generatedPlaceholderNote.systemNote).toBeFalsy(); + expect(generatedPlaceholderNote.content).toBe(sampleComment); }); }); @@ -463,5 +467,23 @@ import '~/notes'; expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeTruthy(); }); }); + + describe('createPlaceholderSystemNote', () => { + const uniqueId = 'b1234-a4567'; + const formContent = 'Applying command to close this issue'; + + it('should return constructed placeholder element for system note based on provided contents', () => { + const $tempNote = this.notes.createPlaceholderSystemNote({ + formContent, + uniqueId + }); + + expect($tempNote.prop('nodeName')).toEqual('LI'); + expect($tempNote.attr('id')).toEqual(uniqueId); + expect($tempNote.hasClass('system-note')).toBeTruthy(); + expect($tempNote.hasClass('being-posted')).toBeTruthy(); + expect($tempNote.find('.timeline-content i').text().trim()).toEqual(formContent); + }); + }); }); }).call(window); |
