From e63829614e3ae94e38c79738773b1b5747b341b4 Mon Sep 17 00:00:00 2001 From: mhirtie Date: Fri, 17 Apr 2015 11:11:55 +0300 Subject: [PATCH] Fix opening of links in new tab using ctrl. --- frontend/.jshintrc | 1 + .../work-packages-table-directive.js | 2 ++ .../specs/work-packages/work-packages-spec.js | 29 +++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/frontend/.jshintrc b/frontend/.jshintrc index 888d50293e..6f9e22794c 100644 --- a/frontend/.jshintrc +++ b/frontend/.jshintrc @@ -10,6 +10,7 @@ "angular", "inject", "module", + "protractor", "I18n", "Hyperagent", diff --git a/frontend/app/work_packages/directives/work-packages-table-directive.js b/frontend/app/work_packages/directives/work-packages-table-directive.js index cf14bb1ac4..39bbf0e114 100644 --- a/frontend/app/work_packages/directives/work-packages-table-directive.js +++ b/frontend/app/work_packages/directives/work-packages-table-directive.js @@ -215,6 +215,8 @@ module.exports = function(I18n, WorkPackagesTableService, $window, $timeout, fla if ($event.shiftKey) { clearSelection(); activeSelectionBorderIndex = WorkPackagesTableService.selectRowRange(scope.rows, row, activeSelectionBorderIndex); + } else if($event.ctrlKey){ + setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState); } else { setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState); diff --git a/frontend/tests/integration/specs/work-packages/work-packages-spec.js b/frontend/tests/integration/specs/work-packages/work-packages-spec.js index 2f650378ce..be917ba9af 100644 --- a/frontend/tests/integration/specs/work-packages/work-packages-spec.js +++ b/frontend/tests/integration/specs/work-packages/work-packages-spec.js @@ -32,6 +32,11 @@ var expect = require('../../spec_helper.js').expect, describe('OpenProject', function() { var page = new WorkPackagesPage(); + beforeEach(function() { + page.get(); + browser.waitForAngular(); + }); + it('should show work packages title', function() { page.get(); @@ -52,4 +57,28 @@ describe('OpenProject', function() { ]); }); }); + + describe('click', function() { + context('with Ctrl', function() { + var newWindowHandle; + + beforeEach(function() { + var link = element(by.css('[title="16923"]')); + browser.actions() + .mouseMove(link) + .sendKeys(protractor.Key.CONTROL) + .click() + .perform(); + }); + + it('opens new tab', function() { + browser.getAllWindowHandles().then(function (handles) { + newWindowHandle = handles[1]; + browser.switchTo().window(newWindowHandle).then(function () { + expect(browser.getCurrentUrl()).to.eventually.contain('/work_packages/16923'); + }); + }); + }); + }); + }); });