diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-04-10 15:51:24 -0500 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-04-20 13:34:18 -0500 |
commit | 36387ce1b4a687a41f450c9fcccc348e478ca296 (patch) | |
tree | f22ef9dcfaef98e2bd643d63ec5e06fa46d28cfd /spec/javascripts | |
parent | 60a6389a7223f14156aeeec9a3854f8ea88de1f0 (diff) | |
download | gitlab-ce-36387ce1b4a687a41f450c9fcccc348e478ca296.tar.gz |
Add Fork/Cancel confirmation to "Replace"/"Delete" buttons30637-replace-delete-buttons-get-fork-cancel-confirmation
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/30637
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/blob/blob_fork_suggestion_spec.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/javascripts/blob/blob_fork_suggestion_spec.js b/spec/javascripts/blob/blob_fork_suggestion_spec.js new file mode 100644 index 00000000000..d0d64d75957 --- /dev/null +++ b/spec/javascripts/blob/blob_fork_suggestion_spec.js @@ -0,0 +1,37 @@ +import BlobForkSuggestion from '~/blob/blob_fork_suggestion'; + +describe('BlobForkSuggestion', () => { + let blobForkSuggestion; + + const openButtons = [document.createElement('div')]; + const forkButtons = [document.createElement('a')]; + const cancelButtons = [document.createElement('div')]; + const suggestionSections = [document.createElement('div')]; + const actionTextPieces = [document.createElement('div')]; + + beforeEach(() => { + blobForkSuggestion = new BlobForkSuggestion({ + openButtons, + forkButtons, + cancelButtons, + suggestionSections, + actionTextPieces, + }); + }); + + afterEach(() => { + blobForkSuggestion.destroy(); + }); + + it('showSuggestionSection', () => { + blobForkSuggestion.showSuggestionSection('/foo', 'foo'); + expect(suggestionSections[0].classList.contains('hidden')).toEqual(false); + expect(forkButtons[0].getAttribute('href')).toEqual('/foo'); + expect(actionTextPieces[0].textContent).toEqual('foo'); + }); + + it('hideSuggestionSection', () => { + blobForkSuggestion.hideSuggestionSection(); + expect(suggestionSections[0].classList.contains('hidden')).toEqual(true); + }); +}); |