aboutsummaryrefslogtreecommitdiffstats
path: root/test/EntityDeclarationTest.js
diff options
context:
space:
mode:
authorMisko Hevery2010-01-25 20:02:24 -0800
committerMisko Hevery2010-01-25 20:02:24 -0800
commit0b630972b15676b1c1b6c59edd564e4ee331ec70 (patch)
treebd31ca5b69b6ea03d906a3107dfe38a8c1adcb8e /test/EntityDeclarationTest.js
parent19bbee030ba012b8fc4835c1d17e039804b2b94b (diff)
parent473e57e22532f9b85fc9dcc1bcc53e12a10154c2 (diff)
downloadangular.js-0b630972b15676b1c1b6c59edd564e4ee331ec70.tar.bz2
merge
Diffstat (limited to 'test/EntityDeclarationTest.js')
-rw-r--r--test/EntityDeclarationTest.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/test/EntityDeclarationTest.js b/test/EntityDeclarationTest.js
index 5cab90f4..28986ea8 100644
--- a/test/EntityDeclarationTest.js
+++ b/test/EntityDeclarationTest.js
@@ -2,31 +2,34 @@ EntityDeclarationTest = TestCase('EntityDeclarationTest');
EntityDeclarationTest.prototype.testEntityTypeOnly = function(){
expectAsserts(2);
- var scope = new nglr.Scope({$datastore:{entity:function(name){
+ var datastore = {entity:function(name){
assertEquals("Person", name);
- }}});
- var init = scope.entity("Person");
+ }};
+ var scope = new Scope();
+ var init = scope.entity("Person", datastore);
assertEquals("", init);
};
EntityDeclarationTest.prototype.testWithDefaults = function(){
expectAsserts(4);
- var scope = new nglr.Scope({$datastore:{entity:function(name, init){
+ var datastore = {entity:function(name, init){
assertEquals("Person", name);
assertEquals("=a:", init.a);
assertEquals(0, init.b.length);
- }}});
- var init = scope.entity('Person:{a:"=a:", b:[]}');
+ }};
+ var scope = new Scope();
+ var init = scope.entity('Person:{a:"=a:", b:[]}', datastore);
assertEquals("", init);
};
EntityDeclarationTest.prototype.testWithName = function(){
expectAsserts(2);
- var scope = new nglr.Scope({$datastore:{entity:function(name, init){
+ var datastore = {entity:function(name, init){
assertEquals("Person", name);
return function (){ return {}; };
- }}});
- var init = scope.entity('friend=Person');
+ }};
+ var scope = new Scope();
+ var init = scope.entity('friend=Person', datastore);
assertEquals("$anchor.friend:{friend=Person.load($anchor.friend);friend.$$anchor=\"friend\";};", init);
};
@@ -34,12 +37,13 @@ EntityDeclarationTest.prototype.testMultipleEntities = function(){
expectAsserts(3);
var expect = ['Person', 'Book'];
var i=0;
- var scope = new nglr.Scope({$datastore:{entity:function(name, init){
+ var datastore = {entity:function(name, init){
assertEquals(expect[i], name);
i++;
return function (){ return {}; };
- }}});
- var init = scope.entity('friend=Person;book=Book;');
+ }};
+ var scope = new Scope();
+ var init = scope.entity('friend=Person;book=Book;', datastore);
assertEquals("$anchor.friend:{friend=Person.load($anchor.friend);friend.$$anchor=\"friend\";};" +
"$anchor.book:{book=Book.load($anchor.book);book.$$anchor=\"book\";};",
init);