Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-03-23 19:52:35 +0300
committerWinnie Hellmann <winnie@gitlab.com>2019-03-23 19:53:46 +0300
commit514ee63826e47229bfd03bdbb740f2dd1eae1d03 (patch)
tree3f0d96a4402e8aa54c375084cc4c5e6cf546824b /spec/frontend/blob
parent6d330015dfdb1979a0773c87c53b84cc86b28a6d (diff)
Move some tests from Karma to Jest
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r--spec/frontend/blob/blob_fork_suggestion_spec.js39
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);
+ });
+});