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:
Diffstat (limited to 'spec/frontend/breakpoints_spec.js')
-rw-r--r--spec/frontend/breakpoints_spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/frontend/breakpoints_spec.js b/spec/frontend/breakpoints_spec.js
new file mode 100644
index 00000000000..c9014ddd3e2
--- /dev/null
+++ b/spec/frontend/breakpoints_spec.js
@@ -0,0 +1,27 @@
+import bp, { breakpoints } from '~/breakpoints';
+
+describe('breakpoints', () => {
+ Object.keys(breakpoints).forEach(key => {
+ const size = breakpoints[key];
+
+ it(`returns ${key} when larger than ${size}`, () => {
+ jest.spyOn(bp, 'windowWidth').mockReturnValue(size + 10);
+
+ expect(bp.getBreakpointSize()).toBe(key);
+ });
+ });
+
+ describe('isDesktop', () => {
+ it('returns true when screen size is medium', () => {
+ jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.md + 10);
+
+ expect(bp.isDesktop()).toBe(true);
+ });
+
+ it('returns false when screen size is small', () => {
+ jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.sm + 10);
+
+ expect(bp.isDesktop()).toBe(false);
+ });
+ });
+});