diff options
author | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 19:09:40 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 19:09:40 +0300 |
commit | 936f463bafcbe846f231f14ae29db20a920b1ca8 (patch) | |
tree | 756c68eca045558142631010d96183e00bebcacb /spec | |
parent | 36431288a2349878964f07a21a7b6b99dfbd2dcb (diff) |
Add tests for `gl.utils.isMetaClick`
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/lib/utils/common_utils_spec.js.es6 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js.es6 b/spec/javascripts/lib/utils/common_utils_spec.js.es6 index fbb06f3948b..d10403cfb4e 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js.es6 +++ b/spec/javascripts/lib/utils/common_utils_spec.js.es6 @@ -73,5 +73,37 @@ require('~/lib/utils/common_utils'); expect(normalized[NGINX].nginx).toBe('ok'); }); }); + + describe('gl.utils.isMetaClick', () => { + it('should identify meta click on Windows/Linux', () => { + const e = { + metaKey: false, + ctrlKey: true, + which: 1, + }; + + expect(gl.utils.isMetaClick(e)).toBe(true); + }); + + it('should identify meta click on macOS', () => { + const e = { + metaKey: true, + ctrlKey: false, + which: 1, + }; + + expect(gl.utils.isMetaClick(e)).toBe(true); + }); + + it('should identify as meta click on middle-click or Mouse-wheel click', () => { + const e = { + metaKey: false, + ctrlKey: false, + which: 2, + }; + + expect(gl.utils.isMetaClick(e)).toBe(true); + }); + }); }); })(); |