File: test-is-dynamic.r

package info (click to toggle)
r-cran-ggvis 0.4.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,716 kB
  • sloc: sh: 25; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 519 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
context("is.dynamic")
library(shiny)

test_that("regular plot is not dynamic", {
  p <- mtcars %>% ggvis(x = ~wt, y = ~cyl) %>% layer_points()
  expect_false(is.dynamic(p))
})

test_that("plot with reactive data source is dynamic", {
  p <- shiny::reactive(mtcars) %>% ggvis(x = ~wt, y = ~cyl) %>% layer_points()
  expect_true(is.dynamic(p))
})

test_that("plot with reactive transform param is dynamic", {
  p <- mtcars %>% ggvis(~mpg, ~wt) %>% layer_smooths(span = input_slider(0, 1))
  expect_true(is.dynamic(p))
})