From 4b0f2dfe0cbd4b5348af8cfb5af2e40904c73a47 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Tue, 31 May 2011 14:51:47 +0200 Subject: Fix IE bug - ng:href ng:href was producing unclickable links, as the event propagation was stopped by 'a' widget All links in regression/issue-352.html were tested in: * Chrome 11 * Opera 11 * Firefox 4 * IE7, IE8 Closes #352 --- src/markups.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'src/markups.js') diff --git a/src/markups.js b/src/markups.js index 24de5c37..2a9b1c3e 100644 --- a/src/markups.js +++ b/src/markups.js @@ -105,6 +105,59 @@ angularTextMarkup('option', function(text, textNode, parentElement){ * * @element ANY * @param {template} template any string which can contain `{{}}` markup. + * + * @example + * This example uses `link` variable inside `href` attribute: + + +
+ link 1 (link, don't reload)
+ link 2 (link, don't reload)
+ link 3 (link, reload!)
+ anchor (link, don't reload)
+ anchor (no link)
+ link (link, change hash) +
+ + it('should execute ng:click but not reload when href without value', function() { + element('#link-1').click(); + expect(element('input[name=value]').val()).toEqual('1'); + expect(element('#link-1').attr('href')).toBe(""); + }); + + it('should execute ng:click but not reload when href empty string', function() { + element('#link-2').click(); + expect(element('input[name=value]').val()).toEqual('2'); + expect(element('#link-2').attr('href')).toBe(""); + }); + + it('should execute ng:click and change url when ng:href specified', function() { + element('#link-3').click(); + expect(element('input[name=value]').val()).toEqual('3'); + expect(element('#link-3').attr('href')).toBe("#123"); + expect(browser().location().hash()).toEqual('123'); + }); + + it('should execute ng:click but not reload when href empty string and name specified', function() { + element('#link-4').click(); + expect(element('input[name=value]').val()).toEqual('4'); + expect(element('#link-4').attr('href')).toBe(""); + }); + + it('should execute ng:click but not reload when no href but name specified', function() { + element('#link-5').click(); + expect(element('input[name=value]').val()).toEqual('5'); + expect(element('#link-5').attr('href')).toBe(undefined); + }); + + it('should only change url when only ng:href', function() { + input('value').enter('6'); + element('#link-6').click(); + expect(browser().location().hash()).toEqual('/6'); + expect(element('#link-6').attr('href')).toBe("#/6"); + }); + +
*/ /** -- cgit v1.2.3