@@ -504,22 +504,23 @@ test_that("popup-lines-table", {
504504})
505505
506506test_that(" popup-lines-spatial" , {
507- popups <- suppressWarnings( sf :: as_Spatial( storms ))
508- # # SpatialLinesDataFrame ##############
507+ # # Simple Feature ##############
508+ library( sf )
509509 m <- leaflet() %> % addTiles() %> %
510510 addGlPolylines(data = storms ,
511- popup = popups ,
511+ popup = storms ,
512512 opacity = 1 )
513+
513514 expect_is(m , " leaflet" )
514515 expect_true(yyjsonr :: validate_json_str(m $ x $ calls [[2 ]]$ args [[3 ]]))
515516
516- # # Simple Feature ##############
517- library(sf )
517+ skip_if_not_installed(" sp" )
518+ popups <- suppressWarnings(sf :: as_Spatial(storms ))
519+ # # SpatialLinesDataFrame ##############
518520 m <- leaflet() %> % addTiles() %> %
519521 addGlPolylines(data = storms ,
520- popup = storms ,
522+ popup = popups ,
521523 opacity = 1 )
522-
523524 expect_is(m , " leaflet" )
524525 expect_true(yyjsonr :: validate_json_str(m $ x $ calls [[2 ]]$ args [[3 ]]))
525526})
@@ -717,22 +718,22 @@ test_that("popup-polygon-table", {
717718})
718719
719720test_that(" popup-polygon-spatial" , {
720- # # SpatialPolygonsDataFrame ##############
721- popups <- suppressWarnings (sf :: as_Spatial( gadm ) )
721+ # # Simple Feature ##############
722+ library (sf )
722723 m <- leaflet() %> % addTiles() %> %
723724 addGlPolygons(data = gadm ,
724- popup = popups ,
725- opacity = 1 )
725+ popup = gadm ,
726+ opacity = 1 )
727+
726728 expect_is(m , " leaflet" )
727729 expect_true(yyjsonr :: validate_json_str(m $ x $ calls [[2 ]]$ args [[3 ]]))
728-
729- # # Simple Feature ##############
730- library (sf )
730+ # # SpatialPolygonsDataFrame ##############
731+ skip_if_not_installed( " sp " )
732+ popups <- suppressWarnings (sf :: as_Spatial( gadm ) )
731733 m <- leaflet() %> % addTiles() %> %
732734 addGlPolygons(data = gadm ,
733- popup = gadm ,
735+ popup = popups ,
734736 opacity = 1 )
735-
736737 expect_is(m , " leaflet" )
737738 expect_true(yyjsonr :: validate_json_str(m $ x $ calls [[2 ]]$ args [[3 ]]))
738739})
0 commit comments