summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-10 21:14:16 +0000
committerSimon Knox <psimyn@gmail.com>2017-08-15 09:43:25 +1000
commit30ee60766a191e97b71b147d09a3a31a3669b548 (patch)
tree2fa3426f3c3063a34654f93f1677f82ee82f5a70 /spec
parent574f6a58d233e943e061978700e584d2ffe91a40 (diff)
downloadgitlab-ce-30ee60766a191e97b71b147d09a3a31a3669b548.tar.gz
Merge branch 'breakpoint-checker-performance' into 'master'
Increase performance of the breakpoint size checker See merge request !13454
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/breakpoints_spec.js15
-rw-r--r--spec/javascripts/fly_out_nav_spec.js2
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/javascripts/breakpoints_spec.js b/spec/javascripts/breakpoints_spec.js
new file mode 100644
index 00000000000..b1b5d36c1fb
--- /dev/null
+++ b/spec/javascripts/breakpoints_spec.js
@@ -0,0 +1,15 @@
+import bp, {
+ breakpoints,
+} from '~/breakpoints';
+
+describe('breakpoints', () => {
+ Object.keys(breakpoints).forEach((key) => {
+ const size = breakpoints[key];
+
+ it(`returns ${key} when larger than ${size}`, () => {
+ spyOn(bp, 'windowWidth').and.returnValue(size + 10);
+
+ expect(bp.getBreakpointSize()).toBe(key);
+ });
+ });
+});
diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js
index d7b7acaa3f4..e44d874ad2b 100644
--- a/spec/javascripts/fly_out_nav_spec.js
+++ b/spec/javascripts/fly_out_nav_spec.js
@@ -1,4 +1,3 @@
-/* global bp */
import Cookies from 'js-cookie';
import {
calculateTop,
@@ -7,6 +6,7 @@ import {
canShowSubItems,
canShowActiveSubItems,
} from '~/fly_out_nav';
+import bp from '~/breakpoints';
describe('Fly out sidebar navigation', () => {
let el;