aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2010-03-29 21:36:34 -0700
committerMisko Hevery2010-03-29 21:36:34 -0700
commitcc6def854f2c77d0a7fea177df0dca858b8cd943 (patch)
treea47a1b9837ebbc5401a4cdcffbecec14737ab9ce /test
parente55c97debaa0ef8487ece219b6eadbc147ece1f9 (diff)
downloadangular.js-cc6def854f2c77d0a7fea177df0dca858b8cd943.tar.bz2
reenabled more tests
Diffstat (limited to 'test')
-rw-r--r--test/ValidatorsTest.js27
-rw-r--r--test/widgetsSpec.js4
2 files changed, 22 insertions, 9 deletions
diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js
index 971ff0bb..37be526d 100644
--- a/test/ValidatorsTest.js
+++ b/test/ValidatorsTest.js
@@ -91,24 +91,35 @@ describe('Validator:asynchronous', function(){
value = null;
fn = null;
self = {
- $element:jqLite('<input />')[0],
+ $element:jqLite('<input />'),
$invalidWidgets:[],
$updateView: noop
};
});
- xit('should make a request and show spinner', function(){
- var x = compile('<input name="name" ng-validate="asynchronous:asyncFn"/>');
- var asyncFn = function(v,f){value=v; fn=f;};
- var input = x.node.find(":input");
- x.scope.$set("asyncFn", asyncFn);
- x.scope.$set("name", "misko");
- x.scope.$eval();
+ afterEach(function(){
+ if (self.$element) self.$element.remove();
+ var oldCache = jqCache;
+ jqCache = {};
+ expect(size(oldCache)).toEqual(0);
+ });
+
+ it('should make a request and show spinner', function(){
+ var value, fn;
+ var scope = angular.compile('<input type="text" name="name" ng-validate="asynchronous:asyncFn"/>');
+ scope.$init();
+ var input = scope.$element;
+ scope.asyncFn = function(v,f){
+ value=v; fn=f;
+ };
+ scope.name = "misko";
+ scope.$eval();
expect(value).toEqual('misko');
expect(input.hasClass('ng-input-indicator-wait')).toBeTruthy();
fn("myError");
expect(input.hasClass('ng-input-indicator-wait')).toBeFalsy();
expect(input.attr('ng-error')).toEqual("myError");
+ scope.$element.remove();
});
it("should not make second request to same value", function(){
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index dd65b5bd..152b01f3 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -15,7 +15,9 @@ describe("input widget", function(){
afterEach(function(){
if (element) element.remove();
- expect(size(jqCache)).toEqual(0);
+ var oldCache = jqCache;
+ jqCache = {};
+ expect(size(oldCache)).toEqual(0);
});
it('should input-text auto init and handle keyup/change events', function(){