tests/testthat/test-div_method.R

testthat::context("div methods")

test_css <- htmltools::css(marginLeft='auto',marginRight='auto')

testthat::describe('slick div method',{

  it('shiny.tag',{
    testthat::expect_equal(
      slick_div(htmltools::p('abc')),
      htmltools::p('abc')
    )
  })
    
  it('list',{
    testthat::expect_equal(
      slick_div(list($uri[1])),
      list(list(htmltools::img(src =  as.character($uri[1]), style = test_css)))
    )
  })
  
  it('list with link',{
    testthat::expect_equal(
      slick_div(list($uri[1]),links = $player_home[1]),
      list(list(
        htmltools::a(
          htmltools::img(src =  $uri[1], style = test_css),
          href = $player_home[1], target="_blank"
        )))
    )
  })

  it('xml',{
    testthat::expect_equal({
      # set.seed(123)
      # svglite::xmlSVG({plot(1:10)}, standalone = TRUE)
      slick_div(xml2::read_xml('../assets/method_test.xml'))
    },
      readRDS('../assets/xml_plot.Rds')
    )
  })

  # it('widget',{
  #   testthat::skip_on_os(os = c("windows","linux",'solaris'))
  #   testthat::expect_equal({
  #     set.seed(123)
  #     slick_div(readRDS('../assets/widget1.Rds'))
  #     },
  #     readRDS('../assets/slick_div_widget.Rds')
  #   )
  # })
})

Try the slickR package in your browser

Any scripts or data that you put into this service are public.

slickR documentation built on Dec. 28, 2022, 2:41 a.m.