@@ -287,4 +287,47 @@ describe('Parse.GeoPoint testing', () => {
287287 done ( ) ;
288288 } ) ;
289289 } ) ;
290+
291+ it ( 'supports a sub-object with a geo point' , done => {
292+ var point = new Parse . GeoPoint ( 44.0 , - 11.0 ) ;
293+ var obj = new TestObject ( ) ;
294+ obj . set ( 'subobject' , { location : point } ) ;
295+ obj . save ( null , {
296+ success : function ( ) {
297+ var query = new Parse . Query ( TestObject ) ;
298+ query . find ( {
299+ success : function ( results ) {
300+ equal ( results . length , 1 ) ;
301+ var pointAgain = results [ 0 ] . get ( 'subobject' ) [ 'location' ] ;
302+ ok ( pointAgain ) ;
303+ equal ( pointAgain . latitude , 44.0 ) ;
304+ equal ( pointAgain . longitude , - 11.0 ) ;
305+ done ( ) ;
306+ }
307+ } ) ;
308+ }
309+ } ) ;
310+ } ) ;
311+
312+ it ( 'supports array of geo points' , done => {
313+ var point1 = new Parse . GeoPoint ( 44.0 , - 11.0 ) ;
314+ var point2 = new Parse . GeoPoint ( 22.0 , - 55.0 ) ;
315+ var obj = new TestObject ( ) ;
316+ obj . set ( 'locations' , [ point1 , point2 ] ) ;
317+ obj . save ( null , {
318+ success : function ( ) {
319+ var query = new Parse . Query ( TestObject ) ;
320+ query . find ( {
321+ success : function ( results ) {
322+ equal ( results . length , 1 ) ;
323+ var locations = results [ 0 ] . get ( 'locations' ) ;
324+ expect ( locations . length ) . toEqual ( 2 ) ;
325+ expect ( locations [ 0 ] ) . toEqual ( point1 ) ;
326+ expect ( locations [ 1 ] ) . toEqual ( point2 ) ;
327+ done ( ) ;
328+ }
329+ } ) ;
330+ }
331+ } ) ;
332+ } ) ;
290333} ) ;
0 commit comments