diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-04-21 13:56:27 -0500 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-04-22 11:51:07 -0500 |
commit | 5f7b4cb5d8061f83f07ce079157d7d98e4257926 (patch) | |
tree | f4cc723cd0343b07d425e75a4694e0db0dd4a188 /spec | |
parent | 9c35162f83fb62349b922baaf192038522b09793 (diff) | |
download | gitlab-ce-5f7b4cb5d8061f83f07ce079157d7d98e4257926.tar.gz |
Use jQuery niceness on blob_fork_suggestionuse-jquery-on-blob-fork-suggestion
Fix
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10602#note_27871752
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/blob/blob_fork_suggestion_spec.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/spec/javascripts/blob/blob_fork_suggestion_spec.js b/spec/javascripts/blob/blob_fork_suggestion_spec.js index d0d64d75957..d1ab0a32f85 100644 --- a/spec/javascripts/blob/blob_fork_suggestion_spec.js +++ b/spec/javascripts/blob/blob_fork_suggestion_spec.js @@ -3,20 +3,21 @@ 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')]; + 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, - forkButtons, - cancelButtons, - suggestionSections, - actionTextPieces, - }); + openButtons: openButton, + forkButtons: forkButton, + cancelButtons: cancelButton, + suggestionSections: suggestionSection, + actionTextPieces: actionTextPiece, + }) + .init(); }); afterEach(() => { @@ -25,13 +26,13 @@ describe('BlobForkSuggestion', () => { 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'); + expect(suggestionSection.classList.contains('hidden')).toEqual(false); + expect(forkButton.getAttribute('href')).toEqual('/foo'); + expect(actionTextPiece.textContent).toEqual('foo'); }); it('hideSuggestionSection', () => { blobForkSuggestion.hideSuggestionSection(); - expect(suggestionSections[0].classList.contains('hidden')).toEqual(true); + expect(suggestionSection.classList.contains('hidden')).toEqual(true); }); }); |