diff options
author | Kushal Pandya <kushal@gitlab.com> | 2017-02-06 13:06:57 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 18:42:01 +0300 |
commit | 8a4da74030d32cf911f9a293f6774fc12a5e7ae4 (patch) | |
tree | 6005f5dd692f57c2e9b73155e0d8a03948c9ac41 /spec/javascripts | |
parent | 00018892e5f19620afb61e8f5f0cb93ec4c04cde (diff) |
Tests for clickTab with Mac and PC
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/merge_request_tabs_spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index d20a59df041..1a0fcd4e33e 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -61,6 +61,42 @@ require('vendor/jquery.scrollTo'); expect($('#diffs')).toHaveClass('active'); }); }); + describe('#opensInNewTab', function () { + it('opens page tab in a new browser tab with Ctrl+Click - Windows/Linux', function () { + const commitsLink = '.commits-tab li a'; + const tabUrl = $(commitsLink).attr('href'); + + spyOn($.fn, 'attr').and.returnValue(tabUrl); + spyOn(window, 'open').and.callFake(function (url, name) { + expect(url).toEqual(tabUrl); + expect(name).toEqual('_blank'); + }); + + this.class.clickTab({ + metaKey: false, + ctrlKey: true, + which: 1, + stopImmediatePropagation: function () {} + }); + }); + it('opens page tab in a new browser tab with Cmd+Click - Mac', function () { + const commitsLink = '.commits-tab li a'; + const tabUrl = $(commitsLink).attr('href'); + + spyOn($.fn, 'attr').and.returnValue(tabUrl); + spyOn(window, 'open').and.callFake(function (url, name) { + expect(url).toEqual(tabUrl); + expect(name).toEqual('_blank'); + }); + + this.class.clickTab({ + metaKey: true, + ctrlKey: false, + which: 1, + stopImmediatePropagation: function () {} + }); + }); + }); describe('#setCurrentAction', function () { beforeEach(function () { |