diff options
| author | Misko Hevery | 2010-03-15 14:36:50 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-03-15 14:36:50 -0700 | 
| commit | cc71b745c3c821f5e012a363ae3267252a81fddb (patch) | |
| tree | b86a76a131aa222b8bdf032480dc2ef0dca51a97 /test/AngularSpec.js | |
| parent | bf838aab5d65a1019a4867b496e971c488589512 (diff) | |
| download | angular.js-cc71b745c3c821f5e012a363ae3267252a81fddb.tar.bz2 | |
added resources; removed compiled code
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 36 | 
1 files changed, 35 insertions, 1 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 65a32279..043f7bf3 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -7,4 +7,38 @@ describe('Angular', function(){      scope.updateView();      expect(onUpdateView).wasCalled();    }); -});
\ No newline at end of file +}); + +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); +  }); +});  | 
