diff options
author | Adriel Santiago <adriel@gitlab.com> | 2019-01-24 02:06:40 +0300 |
---|---|---|
committer | Adriel Santiago <adriel@gitlab.com> | 2019-02-04 16:04:45 +0300 |
commit | c974f4a82ee3cd4b5b73b95d66d99854a0e5d3bc (patch) | |
tree | 183122acce41af316c31515c5c7431e886db282b /spec/javascripts/lib/utils/common_utils_spec.js | |
parent | 2b0f4df0217b4a4aee53f964610d66ceedb68dca (diff) |
Handle window and container resize events
Resizes metrics graph on window and sidebard width changes
Diffstat (limited to 'spec/javascripts/lib/utils/common_utils_spec.js')
-rw-r--r-- | spec/javascripts/lib/utils/common_utils_spec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js index e3fd9604474..3eff3f655ee 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js +++ b/spec/javascripts/lib/utils/common_utils_spec.js @@ -232,6 +232,21 @@ describe('common_utils', () => { }); }); + describe('debounceByAnimationFrame', () => { + it('debounces a function to allow a maximum of one call per animation frame', done => { + const spy = jasmine.createSpy('spy'); + const debouncedSpy = commonUtils.debounceByAnimationFrame(spy); + window.requestAnimationFrame(() => { + debouncedSpy(); + debouncedSpy(); + window.requestAnimationFrame(() => { + expect(spy).toHaveBeenCalledTimes(1); + done(); + }); + }); + }); + }); + describe('getParameterByName', () => { beforeEach(() => { window.history.pushState({}, null, '?scope=all&p=2'); |