aboutsummaryrefslogtreecommitdiffstats
path: root/test/BinderTest.js
diff options
context:
space:
mode:
authorIgor Minar2010-10-12 05:36:38 +0800
committerMisko Hevery2010-10-13 04:37:46 +0800
commit70ff7a2639fc55936854ad04a6242a700ae71a02 (patch)
treebe82632c890b9734d50cd681737b6bad9a689d91 /test/BinderTest.js
parent7e47a2d016676f37287203f26689cce1ee1eaa0c (diff)
downloadangular.js-70ff7a2639fc55936854ad04a6242a700ae71a02.tar.bz2
fix memory leak caused by leftbehind $invalidWidgets references
- ng:switch should not clean up $invalidWidgets - $invalidWidgets should be clean up after each eval - add missing docs
Diffstat (limited to 'test/BinderTest.js')
-rw-r--r--test/BinderTest.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js
index f38383ae..5d72206d 100644
--- a/test/BinderTest.js
+++ b/test/BinderTest.js
@@ -2,10 +2,14 @@ BinderTest = TestCase('BinderTest');
BinderTest.prototype.setUp = function(){
var self = this;
- this.compile = function(html, initialScope, config) {
+
+ this.compile = function(html, initialScope, parent) {
var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget);
var element = self.element = jqLite(html);
var scope = compiler.compile(element)(element);
+
+ if (parent) parent.append(element);
+
extend(scope, initialScope);
scope.$init();
return {node:element, scope:scope};
@@ -506,7 +510,8 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() {
BinderTest.prototype.testValidateForm = function() {
var c = this.compile('<div><input name="name" ng:required>' +
- '<div ng:repeat="item in items"><input name="item.name" ng:required/></div></div>');
+ '<div ng:repeat="item in items"><input name="item.name" ng:required/></div></div>',
+ undefined, jqLite(document.body));
var items = [{}, {}];
c.scope.$set("items", items);
c.scope.$eval();
@@ -534,8 +539,7 @@ BinderTest.prototype.testValidateForm = function() {
};
BinderTest.prototype.testValidateOnlyVisibleItems = function(){
- var c = this.compile('<div><input name="name" ng:required><input ng:show="show" name="name" ng:required></div>');
- jqLite(document.body).append(c.node);
+ var c = this.compile('<div><input name="name" ng:required><input ng:show="show" name="name" ng:required></div>', undefined, jqLite(document.body));
c.scope.$set("show", true);
c.scope.$eval();
assertEquals(2, c.scope.$get("$invalidWidgets.length"));