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:
authorJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-09 21:03:09 +0300
committerJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-17 07:57:29 +0300
commit6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch)
treee7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/frequent_items
parent28d412e5b2b8499fba22e8fabb1d44f44449228e (diff)
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/frequent_items')
-rw-r--r--spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js6
-rw-r--r--spec/javascripts/frequent_items/components/frequent_items_list_spec.js6
-rw-r--r--spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js1
3 files changed, 13 insertions, 0 deletions
diff --git a/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js b/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
index 201aca77b10..7deed985219 100644
--- a/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
+++ b/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
@@ -30,9 +30,11 @@ describe('FrequentItemsListItemComponent', () => {
describe('hasAvatar', () => {
it('should return `true` or `false` if whether avatar is present or not', () => {
vm.avatarUrl = 'path/to/avatar.png';
+
expect(vm.hasAvatar).toBe(true);
vm.avatarUrl = null;
+
expect(vm.hasAvatar).toBe(false);
});
});
@@ -40,11 +42,13 @@ describe('FrequentItemsListItemComponent', () => {
describe('highlightedItemName', () => {
it('should enclose part of project name in <b> & </b> which matches with `matcher` prop', () => {
vm.matcher = 'lab';
+
expect(vm.highlightedItemName).toContain('<b>Lab</b>');
});
it('should return project name as it is if `matcher` is not available', () => {
vm.matcher = null;
+
expect(vm.highlightedItemName).toBe(mockProject.name);
});
});
@@ -52,11 +56,13 @@ describe('FrequentItemsListItemComponent', () => {
describe('truncatedNamespace', () => {
it('should truncate project name from namespace string', () => {
vm.namespace = 'platform / nokia-3310';
+
expect(vm.truncatedNamespace).toBe('platform');
});
it('should truncate namespace string from the middle if it includes more than two groups in path', () => {
vm.namespace = 'platform / hardware / broadcom / Wifi Group / Mobile Chipset / nokia-3310';
+
expect(vm.truncatedNamespace).toBe('platform / ... / Mobile Chipset');
});
});
diff --git a/spec/javascripts/frequent_items/components/frequent_items_list_spec.js b/spec/javascripts/frequent_items/components/frequent_items_list_spec.js
index 3003b7ee000..8518a681a26 100644
--- a/spec/javascripts/frequent_items/components/frequent_items_list_spec.js
+++ b/spec/javascripts/frequent_items/components/frequent_items_list_spec.js
@@ -30,9 +30,11 @@ describe('FrequentItemsListComponent', () => {
describe('isListEmpty', () => {
it('should return `true` or `false` representing whether if `items` is empty or not with projects', () => {
vm.items = [];
+
expect(vm.isListEmpty).toBe(true);
vm.items = mockFrequentProjects;
+
expect(vm.isListEmpty).toBe(false);
});
});
@@ -40,9 +42,11 @@ describe('FrequentItemsListComponent', () => {
describe('fetched item messages', () => {
it('should return appropriate empty list message based on value of `localStorageFailed` prop with projects', () => {
vm.isFetchFailed = true;
+
expect(vm.listEmptyMessage).toBe('This feature requires browser localStorage support');
vm.isFetchFailed = false;
+
expect(vm.listEmptyMessage).toBe('Projects you visit often will appear here');
});
});
@@ -51,9 +55,11 @@ describe('FrequentItemsListComponent', () => {
it('should return appropriate empty list message based on value of `searchFailed` prop with projects', () => {
vm.hasSearchQuery = true;
vm.isFetchFailed = true;
+
expect(vm.listEmptyMessage).toBe('Something went wrong on our end.');
vm.isFetchFailed = false;
+
expect(vm.listEmptyMessage).toBe('Sorry, no projects matched your search');
});
});
diff --git a/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js b/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js
index 6a11038e70a..d564292f1ba 100644
--- a/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js
+++ b/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js
@@ -26,6 +26,7 @@ describe('FrequentItemsSearchInputComponent', () => {
spyOn(vm.$refs.search, 'focus');
vm.setFocus();
+
expect(vm.$refs.search.focus).toHaveBeenCalled();
});
});