aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/BinderTest.js14
-rw-r--r--test/CompilerSpec.js9
-rw-r--r--test/directivesSpec.js2
-rw-r--r--test/widgetsSpec.js12
4 files changed, 19 insertions, 18 deletions
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('before<span duplicate="expr">x</span>after');
- expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment>after</div>');
+ expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment><span>x</span>after</div>');
scope.$eval();
- expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment>after</div>');
+ expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment><span>x</span><span>x</span>after</div>');
scope.$eval();
- expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment>after</div>');
+ expect(sortedHtml(scope.$element)).toEqual('<div>before<#comment></#comment><span>x</span><span>x</span><span>x</span>after</div>');
});
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('<input type="button" value="Click Me" ng-change="clicked = true"/>');
- element.click();
+ element.trigger('click');
expect(scope.$get('clicked')).toEqual(true);
});
it('should support button alias', function(){
compile('<button ng-change="clicked = true">Click Me</button>');
- element.click();
+ element.trigger('click');
expect(scope.$get('clicked')).toEqual(true);
});
it('should type="checkbox"', function(){
compile('<input type="checkbox" name="checkbox" checked ng-change="action = true"/>');
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('<button ng-change="a-2=x">click</button>');
- element.click();
+ element.trigger('click');
expect(element.hasClass('ng-exception')).toBeTruthy();
});