diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-03-23 19:52:35 +0300 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-03-23 19:53:46 +0300 |
commit | 514ee63826e47229bfd03bdbb740f2dd1eae1d03 (patch) | |
tree | 3f0d96a4402e8aa54c375084cc4c5e6cf546824b /spec/frontend/blob | |
parent | 6d330015dfdb1979a0773c87c53b84cc86b28a6d (diff) |
Move some tests from Karma to Jest
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r-- | spec/frontend/blob/blob_fork_suggestion_spec.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/frontend/blob/blob_fork_suggestion_spec.js b/spec/frontend/blob/blob_fork_suggestion_spec.js new file mode 100644 index 00000000000..9b81b7e6f92 --- /dev/null +++ b/spec/frontend/blob/blob_fork_suggestion_spec.js @@ -0,0 +1,39 @@ +import BlobForkSuggestion from '~/blob/blob_fork_suggestion'; + +describe('BlobForkSuggestion', () => { + let blobForkSuggestion; + + const openButton = document.createElement('div'); + const forkButton = document.createElement('a'); + const cancelButton = document.createElement('div'); + const suggestionSection = document.createElement('div'); + const actionTextPiece = document.createElement('div'); + + beforeEach(() => { + blobForkSuggestion = new BlobForkSuggestion({ + openButtons: openButton, + forkButtons: forkButton, + cancelButtons: cancelButton, + suggestionSections: suggestionSection, + actionTextPieces: actionTextPiece, + }).init(); + }); + + afterEach(() => { + blobForkSuggestion.destroy(); + }); + + it('showSuggestionSection', () => { + blobForkSuggestion.showSuggestionSection('/foo', 'foo'); + + expect(suggestionSection.classList.contains('hidden')).toEqual(false); + expect(forkButton.getAttribute('href')).toEqual('/foo'); + expect(actionTextPiece.textContent).toEqual('foo'); + }); + + it('hideSuggestionSection', () => { + blobForkSuggestion.hideSuggestionSection(); + + expect(suggestionSection.classList.contains('hidden')).toEqual(true); + }); +}); |