aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
authorRob Spies2010-06-22 17:09:55 -0700
committerRob Spies2010-06-22 17:09:55 -0700
commit1500e91defa4020bfe9608749b25e585cd1d8e3d (patch)
tree8c2872252b62567dc4eb00f7d7547661d5674c55 /test/AngularSpec.js
parenteaa397c76b7d28343cde9f3a0338b9b0e79197c8 (diff)
parentb129a1094e6b42ed82c3ccecc2f40daaa0a6cb6a (diff)
downloadangular.js-1500e91defa4020bfe9608749b25e585cd1d8e3d.tar.bz2
Merge http://github.com/angular/angular.js into angular
Conflicts: .gitignore
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
new file mode 100644
index 00000000..de724f03
--- /dev/null
+++ b/test/AngularSpec.js
@@ -0,0 +1,52 @@
+describe('Angular', function(){
+ xit('should fire on updateEvents', function(){
+ var onUpdateView = jasmine.createSpy();
+ var scope = angular.compile("<div></div>", { onUpdateView: onUpdateView });
+ expect(onUpdateView).wasNotCalled();
+ scope.$init();
+ scope.$eval();
+ expect(onUpdateView).wasCalled();
+ });
+});
+
+describe("copy", function(){
+ it("should return same object", function (){
+ var obj = {};
+ var arr = [];
+ assertSame(obj, copy({}, obj));
+ assertSame(arr, copy([], arr));
+ });
+
+ it("should copy array", function(){
+ var src = [1, {name:"value"}];
+ var dst = [{key:"v"}];
+ assertSame(dst, copy(src, dst));
+ assertEquals([1, {name:"value"}], dst);
+ assertEquals({name:"value"}, dst[1]);
+ assertNotSame(src[1], dst[1]);
+ });
+
+ it('should copy empty array', function() {
+ var src = [];
+ var dst = [{key: "v"}];
+ assertEquals([], copy(src, dst));
+ assertEquals([], dst);
+ });
+
+ it("should copy object", function(){
+ var src = {a:{name:"value"}};
+ var dst = {b:{key:"v"}};
+ assertSame(dst, copy(src, dst));
+ assertEquals({a:{name:"value"}}, dst);
+ assertEquals(src.a, dst.a);
+ assertNotSame(src.a, dst.a);
+ });
+
+ it("should copy primitives", function(){
+ expect(copy(null)).toEqual(null);
+ expect(copy('')).toEqual('');
+ expect(copy(123)).toEqual(123);
+ expect(copy([{key:null}])).toEqual([{key:null}]);
+ });
+
+});