simplifying ng:click spec

This commit is contained in:
Igor Minar 2010-10-22 16:45:56 -07:00 committed by Misko Hevery
parent 64063b5d41
commit bbd87c9425
2 changed files with 7 additions and 7 deletions

View file

@ -205,7 +205,7 @@ angularWidget("@ng:repeat", function(expression, element){
* *
* Events that are handled via these handler are always configured not to propagate further. * Events that are handled via these handler are always configured not to propagate further.
* *
* TODO: maybe we should consider allowing users to control even propagation in the future. * TODO: maybe we should consider allowing users to control event propagation in the future.
*/ */
angularDirective("ng:click", function(expression, element){ angularDirective("ng:click", function(expression, element){
return function(element){ return function(element){

View file

@ -172,7 +172,7 @@ describe("directives", function(){
}); });
describe('ng:click', function(){ describe('ng:click', function(){
it('should fire event', function(){ it('should get called on a click', function(){
var scope = compile('<div ng:click="clicked = true"></div>'); var scope = compile('<div ng:click="clicked = true"></div>');
scope.$eval(); scope.$eval();
expect(scope.$get('clicked')).toBeFalsy(); expect(scope.$get('clicked')).toBeFalsy();
@ -184,14 +184,14 @@ describe("directives", function(){
it('should stop event propagation', function() { it('should stop event propagation', function() {
var scope = compile('<div ng:click="outer = true"><div ng:click="inner = true"></div></div>'); var scope = compile('<div ng:click="outer = true"><div ng:click="inner = true"></div></div>');
scope.$eval(); scope.$eval();
expect(scope.$get('outer')).not.toBeDefined(); expect(scope.outer).not.toBeDefined();
expect(scope.$get('inner')).not.toBeDefined(); expect(scope.inner).not.toBeDefined();
var innerDiv = jqLite(element.children()[0]); var innerDiv = element.children()[0];
browserTrigger(innerDiv, 'click'); browserTrigger(innerDiv, 'click');
expect(scope.$get('outer')).not.toBeDefined(); expect(scope.outer).not.toBeDefined();
expect(scope.$get('inner')).toEqual(true); expect(scope.inner).toEqual(true);
}); });
}); });