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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-23 18:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-23 18:07:48 +0300
commitfda8735029d5aea76060f2e2b071ebcd6cd0777e (patch)
tree785f01501ab938aeed86fea53063e4598dd28d81 /spec
parent4aeb8a02c506eaa8f0710ee17edd9e35dd68d280 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/feature_highlight/feature_highlight_options_spec.js10
-rw-r--r--spec/javascripts/frequent_items/utils_spec.js18
2 files changed, 20 insertions, 8 deletions
diff --git a/spec/frontend/feature_highlight/feature_highlight_options_spec.js b/spec/frontend/feature_highlight/feature_highlight_options_spec.js
index cd41d1ed091..8b75c46fd4c 100644
--- a/spec/frontend/feature_highlight/feature_highlight_options_spec.js
+++ b/spec/frontend/feature_highlight/feature_highlight_options_spec.js
@@ -1,5 +1,5 @@
+import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import domContentLoaded from '~/feature_highlight/feature_highlight_options';
-import bp from '~/breakpoints';
describe('feature highlight options', () => {
describe('domContentLoaded', () => {
@@ -21,9 +21,15 @@ describe('feature highlight options', () => {
expect(domContentLoaded()).toBe(false);
});
- it('should call highlightFeatures when breakpoint is lg', () => {
+ it('should not call highlightFeatures when breakpoint is not xl', () => {
jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('lg');
+ expect(domContentLoaded()).toBe(false);
+ });
+
+ it('should call highlightFeatures when breakpoint is xl', () => {
+ jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('xl');
+
expect(domContentLoaded()).toBe(true);
});
});
diff --git a/spec/javascripts/frequent_items/utils_spec.js b/spec/javascripts/frequent_items/utils_spec.js
index cd27d79b29a..2480af5b31d 100644
--- a/spec/javascripts/frequent_items/utils_spec.js
+++ b/spec/javascripts/frequent_items/utils_spec.js
@@ -1,10 +1,16 @@
-import bp from '~/breakpoints';
+import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { isMobile, getTopFrequentItems, updateExistingFrequentItem } from '~/frequent_items/utils';
import { HOUR_IN_MS, FREQUENT_ITEMS } from '~/frequent_items/constants';
import { mockProject, unsortedFrequentItems, sortedFrequentItems } from './mock_data';
describe('Frequent Items utils spec', () => {
describe('isMobile', () => {
+ it('returns true when the screen is medium ', () => {
+ spyOn(bp, 'getBreakpointSize').and.returnValue('md');
+
+ expect(isMobile()).toBe(true);
+ });
+
it('returns true when the screen is small ', () => {
spyOn(bp, 'getBreakpointSize').and.returnValue('sm');
@@ -17,8 +23,8 @@ describe('Frequent Items utils spec', () => {
expect(isMobile()).toBe(true);
});
- it('returns false when the screen is larger than small ', () => {
- spyOn(bp, 'getBreakpointSize').and.returnValue('md');
+ it('returns false when the screen is larger than medium ', () => {
+ spyOn(bp, 'getBreakpointSize').and.returnValue('lg');
expect(isMobile()).toBe(false);
});
@@ -32,21 +38,21 @@ describe('Frequent Items utils spec', () => {
});
it('returns correct amount of items for mobile', () => {
- spyOn(bp, 'getBreakpointSize').and.returnValue('sm');
+ spyOn(bp, 'getBreakpointSize').and.returnValue('md');
const result = getTopFrequentItems(unsortedFrequentItems);
expect(result.length).toBe(FREQUENT_ITEMS.LIST_COUNT_MOBILE);
});
it('returns correct amount of items for desktop', () => {
- spyOn(bp, 'getBreakpointSize').and.returnValue('lg');
+ spyOn(bp, 'getBreakpointSize').and.returnValue('xl');
const result = getTopFrequentItems(unsortedFrequentItems);
expect(result.length).toBe(FREQUENT_ITEMS.LIST_COUNT_DESKTOP);
});
it('sorts frequent items in order of frequency and lastAccessedOn', () => {
- spyOn(bp, 'getBreakpointSize').and.returnValue('lg');
+ spyOn(bp, 'getBreakpointSize').and.returnValue('xl');
const result = getTopFrequentItems(unsortedFrequentItems);
const expectedResult = sortedFrequentItems.slice(0, FREQUENT_ITEMS.LIST_COUNT_DESKTOP);