Commit 3633e04f authored by Kushal Pandya's avatar Kushal Pandya

Refactor tests for `#opensInNewTab`

parent a11b2304
...@@ -62,7 +62,7 @@ require('vendor/jquery.scrollTo'); ...@@ -62,7 +62,7 @@ require('vendor/jquery.scrollTo');
}); });
}); });
describe('#opensInNewTab', function () { describe('#opensInNewTab', function () {
it('opens page tab in a new browser tab with Ctrl+Click - Windows/Linux', function () { beforeEach(function () {
const commitsLink = '.commits-tab li a'; const commitsLink = '.commits-tab li a';
const tabUrl = $(commitsLink).attr('href'); const tabUrl = $(commitsLink).attr('href');
...@@ -71,7 +71,8 @@ require('vendor/jquery.scrollTo'); ...@@ -71,7 +71,8 @@ require('vendor/jquery.scrollTo');
expect(url).toEqual(tabUrl); expect(url).toEqual(tabUrl);
expect(name).toEqual('_blank'); expect(name).toEqual('_blank');
}); });
});
it('opens page tab in a new browser tab with Ctrl+Click - Windows/Linux', function () {
this.class.clickTab({ this.class.clickTab({
metaKey: false, metaKey: false,
ctrlKey: true, ctrlKey: true,
...@@ -80,15 +81,6 @@ require('vendor/jquery.scrollTo'); ...@@ -80,15 +81,6 @@ require('vendor/jquery.scrollTo');
}); });
}); });
it('opens page tab in a new browser tab with Cmd+Click - Mac', 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, target) {
expect(url).toEqual(tabUrl);
expect(target).toEqual('_blank');
});
this.class.clickTab({ this.class.clickTab({
metaKey: true, metaKey: true,
ctrlKey: false, ctrlKey: false,
...@@ -97,15 +89,6 @@ require('vendor/jquery.scrollTo'); ...@@ -97,15 +89,6 @@ require('vendor/jquery.scrollTo');
}); });
}); });
it('opens page tab in a new browser tab with Middle-click - Mac/PC', 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({ this.class.clickTab({
metaKey: false, metaKey: false,
ctrlKey: false, ctrlKey: false,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment