| 1 |
test_that("useBusyIndicators()", { |
| 2 |
expect_snapshot( |
| 3 |
tagList( |
| 4 |
useBusyIndicators(), |
| 5 |
useBusyIndicators(spinners = FALSE), |
| 6 |
useBusyIndicators(pulse = FALSE), |
| 7 |
useBusyIndicators(spinners = FALSE, pulse = FALSE), |
| 8 |
) |
| 9 |
) |
| 10 |
|
| 11 |
expect_error(useBusyIndicators("foo")) |
| 12 |
expect_error(useBusyIndicators(foo = "bar")) |
| 13 |
}) |
| 14 |
|
| 15 |
test_that("busyIndicatorOptions()", { |
| 16 |
withPrivateSeed(set.seed(100)) |
| 17 |
|
| 18 |
expect_snapshot( |
| 19 |
tagList( |
| 20 |
busyIndicatorOptions(), |
| 21 |
busyIndicatorOptions(spinner_type = "bars"), |
| 22 |
busyIndicatorOptions(spinner_type = "pulse"), |
| 23 |
busyIndicatorOptions(spinner_type = "dots"), |
| 24 |
busyIndicatorOptions(spinner_color = "red"), |
| 25 |
busyIndicatorOptions(spinner_size = "10px"), |
| 26 |
busyIndicatorOptions(spinner_delay = "1s"), |
| 27 |
busyIndicatorOptions(pulse_background = "blue"), |
| 28 |
busyIndicatorOptions(pulse_height = "10px"), |
| 29 |
busyIndicatorOptions(pulse_speed = "1s"), |
| 30 |
busyIndicatorOptions( |
| 31 |
spinner_color = "red", |
| 32 |
spinner_size = "10px", |
| 33 |
spinner_delay = "1s", |
| 34 |
pulse_background = "blue", |
| 35 |
pulse_height = "10px", |
| 36 |
pulse_speed = "1s" |
| 37 |
) |
| 38 |
) |
| 39 |
) |
| 40 |
|
| 41 |
expect_error(busyIndicatorOptions("foo")) |
| 42 |
expect_error(busyIndicatorOptions(foo = "bar")) |
| 43 |
expect_error(busyIndicatorOptions(spinner_type = "dsflds")) |
| 44 |
expect_error(busyIndicatorOptions(spinner_color = "dsflds")) |
| 45 |
expect_error(busyIndicatorOptions(spinner_size = "dsflds")) |
| 46 |
expect_error(busyIndicatorOptions(pulse_height = "dsflds")) |
| 47 |
}) |
| 48 |
|
| 49 |
|
| 50 |
test_that("Can provide svg file for busyIndicatorOptions(spinner_type)", { |
| 51 |
skip_on_os("windows") |
| 52 |
|
| 53 |
tmpsvg <- tempfile(fileext = ".svg") |
| 54 |
writeLines("<svg></svg>", tmpsvg) |
| 55 |
on.exit(unlink(tmpsvg)) |
| 56 |
|
| 57 |
withPrivateSeed(set.seed(100)) |
| 58 |
expect_snapshot( |
| 59 |
busyIndicatorOptions(spinner_type = tmpsvg) |
| 60 |
) |
| 61 |
}) |