fix(RouterLink): do not prevent default behavior if target set on anchor element
If the anchor element on which the "router-link" directive is present has a target attribute other than "_self," the handler will not prevent default behavior of the browser. Closes #4233 Closes #5082
This commit is contained in:
@ -26,4 +26,19 @@ describe('hash routing example app', function() {
|
||||
|
||||
expect(element(by.css('goodbye-cmp')).getText()).toContain('goodbye');
|
||||
});
|
||||
|
||||
|
||||
it('should open in new window if target is _blank', () => {
|
||||
var URL = 'playground/src/hash_routing/index.html';
|
||||
browser.get(URL + '#/');
|
||||
waitForElement('hello-cmp');
|
||||
|
||||
element(by.css('#goodbye-link-blank')).click();
|
||||
expect(browser.driver.getCurrentUrl()).not.toContain('#/bye');
|
||||
browser.getAllWindowHandles().then(function(windows) {
|
||||
browser.switchTo()
|
||||
.window(windows[1])
|
||||
.then(function() { expect(browser.driver.getCurrentUrl()).toContain("#/bye"); });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user