Tests for clickTab with Mac and PC

This commit is contained in:
Kushal Pandya 2017-02-06 15:36:57 +05:30
parent 00018892e5
commit 8a4da74030
1 changed files with 36 additions and 0 deletions

View File

@ -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 () {