From 22d93e0a3bc2a6dc0f64c63c68bc8f8489ea9068 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 20 Apr 2010 18:14:13 -0700 Subject: fixes to enable ie --- test/BinderTest.js | 14 +++++++------- test/CompilerSpec.js | 9 +++++---- test/directivesSpec.js | 2 +- test/widgetsSpec.js | 12 ++++++------ 4 files changed, 19 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/BinderTest.js b/test/BinderTest.js index 50e1683a..31b2698d 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -151,7 +151,7 @@ BinderTest.prototype.testInputTypeButtonActionExecutesInScope = function(){ c.scope.$set("person.save", function(){ savedCalled = true; }); - c.node.click(); + c.node.trigger('click'); assertTrue(savedCalled); }; @@ -162,7 +162,7 @@ BinderTest.prototype.testInputTypeButtonActionExecutesInScope2 = function(){ log += 'click;'; }); expect(log).toEqual(''); - c.node.click(); + c.node.trigger('click'); expect(log).toEqual('click;'); }; @@ -172,7 +172,7 @@ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){ c.scope.$set("person.save", function(){ savedCalled = true; }); - c.node.click(); + c.node.trigger('click'); assertTrue(savedCalled); }; @@ -435,13 +435,13 @@ BinderTest.prototype.testActionOnAHrefThrowsError = function(){ throw {a:'abc', b:2}; }; var input = c.node; - input.click(); + input.trigger('click'); assertEquals({a:"abc", b:2}, fromJson(input.attr('ng-exception'))); assertTrue("should have an error class", input.hasClass('ng-exception')); // TODO: I think that exception should never get cleared so this portion of test makes no sense //c.scope.action = noop; - //input.click(); + //input.trigger('click'); //dump(input.attr('ng-error')); //assertFalse('error class should be cleared', input.hasClass('ng-exception')); }; @@ -574,10 +574,10 @@ BinderTest.prototype.testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = f var first = jqLite(c.node[0].childNodes[0]); var second = jqLite(c.node[0].childNodes[1]); - first.click(); + first.trigger('click'); assertEquals("ABC", c.scope.greeting); - second.click(); + second.trigger('click'); assertTrue(second.hasClass("ng-exception")); }; diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index fe61c520..e50f6ae7 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -75,21 +75,22 @@ describe('compiler', function(){ it('should allow creation of templates', function(){ directives.duplicate = function(expr, element){ + var parent = element.parent(); element.replaceWith(document.createComment("marker")); element.removeAttr("duplicate"); var template = this.compile(element); return function(marker) { this.$onEval(function() { - marker.after(template(element.clone()).element); + marker.after(template(element.clone()).$element); }); }; }; var scope = compile('beforexafter'); - expect(sortedHtml(scope.$element)).toEqual('
before<#comment>after
'); + expect(sortedHtml(scope.$element)).toEqual('
before<#comment>xafter
'); scope.$eval(); - expect(sortedHtml(scope.$element)).toEqual('
before<#comment>after
'); + expect(sortedHtml(scope.$element)).toEqual('
before<#comment>xxafter
'); scope.$eval(); - expect(sortedHtml(scope.$element)).toEqual('
before<#comment>after
'); + expect(sortedHtml(scope.$element)).toEqual('
before<#comment>xxxafter
'); }); it('should process markup before directives', function(){ diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 1ddd7477..f7024bdb 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -133,7 +133,7 @@ describe("directives", function(){ scope.$eval(); expect(scope.$get('clicked')).toBeFalsy(); - element.click(); + element.trigger('click'); expect(scope.$get('clicked')).toEqual(true); }); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index ecc00d05..2cfe216c 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -136,23 +136,23 @@ describe("input widget", function(){ it('should call ng-change on button click', function(){ compile(''); - element.click(); + element.trigger('click'); expect(scope.$get('clicked')).toEqual(true); }); it('should support button alias', function(){ compile(''); - element.click(); + element.trigger('click'); expect(scope.$get('clicked')).toEqual(true); }); it('should type="checkbox"', function(){ compile(''); expect(scope.checkbox).toEqual(true); - trigger(element, 'click'); + element.trigger('click'); expect(scope.checkbox).toEqual(false); expect(scope.action).toEqual(true); - trigger(element, 'click'); + element.trigger('click'); expect(scope.checkbox).toEqual(true); }); @@ -176,7 +176,7 @@ describe("input widget", function(){ expect(b.checked).toEqual(true); expect(scope.clicked).not.toBeDefined(); - trigger(a, 'click'); + jqLite(a).trigger('click'); expect(scope.chose).toEqual('A'); expect(scope.clicked).toEqual(1); }); @@ -218,7 +218,7 @@ describe("input widget", function(){ it('should report error on ng-change exception', function(){ compile(''); - element.click(); + element.trigger('click'); expect(element.hasClass('ng-exception')).toBeTruthy(); }); -- cgit v1.2.3