@@ -27,11 +27,11 @@ describe("Restangular", function() {
27
27
28
28
infoModel = {
29
29
id : 0 , text : "Some additional account information"
30
- }
30
+ } ;
31
31
32
32
newAccount = { id : 44 , user : "First User" , amount : 45 , transactions : [ ] } ;
33
33
34
- messages = [ { id : 23 , name : "Gonto" } , { id : 45 , name : "John" } ]
34
+ messages = [ { id : 23 , name : "Gonto" } , { id : 45 , name : "John" } ] ;
35
35
36
36
accountsDoSomethingModel = { result : 1 } ;
37
37
@@ -332,7 +332,7 @@ describe("Restangular", function() {
332
332
it ( "Should decorate element both on server and local by default" , function ( ) {
333
333
334
334
Restangular . extendModel ( 'accounts' , function ( account ) {
335
- account . extended = function ( ) { return true ; }
335
+ account . extended = function ( ) { return true ; } ;
336
336
return account ;
337
337
} ) ;
338
338
@@ -476,7 +476,7 @@ describe("Restangular", function() {
476
476
477
477
it ( "Shouldn't be restangularized by default" , function ( ) {
478
478
Restangular . extendModel ( 'accounts' , function ( account ) {
479
- account . extended = function ( ) { return true ; }
479
+ account . extended = function ( ) { return true ; } ;
480
480
return account ;
481
481
} ) ;
482
482
@@ -824,6 +824,21 @@ describe("Restangular", function() {
824
824
copiedAccount . getRestangularUrl ( ) ; // invoke the method we are spying on
825
825
expect ( that ) . toBe ( copiedAccount ) ;
826
826
} ) ;
827
+
828
+ it ( "should copy an object and 'fromServer' param should be the same with the copied object" , function ( ) {
829
+ // with fromServer=true
830
+ restangularAccount1 . get ( ) . then ( function ( account ) {
831
+ var copiedAccount = Restangular . copy ( account ) ;
832
+ expect ( account . fromServer ) . toEqual ( copiedAccount . fromServer ) ;
833
+ } ) ;
834
+
835
+ // with fromServer=false
836
+ var account = Restangular . one ( 'accounts' , 123 ) ,
837
+ copiedAccount = Restangular . copy ( account ) ;
838
+ expect ( account . fromServer ) . toEqual ( copiedAccount . fromServer ) ;
839
+
840
+ $httpBackend . flush ( ) ;
841
+ } ) ;
827
842
} ) ;
828
843
829
844
describe ( "getRestangularUrl" , function ( ) {
@@ -1049,7 +1064,7 @@ describe("Restangular", function() {
1049
1064
} ) ;
1050
1065
1051
1066
it ( 'does not use the id for single nested resource GET' , function ( ) {
1052
- Restangular . one ( 'accounts' , 1 ) . one ( 'info' , 0 , true ) . get ( )
1067
+ Restangular . one ( 'accounts' , 1 ) . one ( 'info' , 0 , true ) . get ( ) ;
1053
1068
$httpBackend . expectGET ( '/accounts/1/info' ) ;
1054
1069
$httpBackend . flush ( ) ;
1055
1070
} ) ;
0 commit comments