From 049ef298e9ad3e3054446870326369f40f2ab164 Mon Sep 17 00:00:00 2001 From: Kushal Pandya <kushal@gitlab.com> Date: Tue, 7 Feb 2017 11:34:42 +0530 Subject: [PATCH] Update param name, add test for `e.which = 2` --- spec/javascripts/merge_request_tabs_spec.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 1a0fcd4e33..07f9797c22 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -84,9 +84,9 @@ require('vendor/jquery.scrollTo'); const tabUrl = $(commitsLink).attr('href'); spyOn($.fn, 'attr').and.returnValue(tabUrl); - spyOn(window, 'open').and.callFake(function (url, name) { + spyOn(window, 'open').and.callFake(function (url, target) { expect(url).toEqual(tabUrl); - expect(name).toEqual('_blank'); + expect(target).toEqual('_blank'); }); this.class.clickTab({ @@ -96,6 +96,23 @@ require('vendor/jquery.scrollTo'); stopImmediatePropagation: function () {} }); }); + it('opens page tab in a new browser tab with Middle-click - Mac/PC', 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, target) { + expect(url).toEqual(tabUrl); + expect(target).toEqual('_blank'); + }); + + this.class.clickTab({ + metaKey: false, + ctrlKey: false, + which: 2, + stopImmediatePropagation: function () {} + }); + }); }); describe('#setCurrentAction', function () { -- 2.30.9