Skip to content

Commit

Permalink
wrong function name (hadley#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuoxv authored Mar 21, 2021
1 parent 9629f8e commit 3f18818
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scaling-testing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ How would we test that this output is as we expect?
We could use `expect_equal()`:

```{r}
test_that("shinyInput01() creates expected HTML", {
test_that("sliderInput01() creates expected HTML", {
expect_equal(as.character(sliderInput01("x")), "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"x-label\" for=\"x\">x</label>\n <input class=\"js-range-slider\" id=\"x\" data-skin=\"shiny\" data-min=\"0\" data-max=\"1\" data-from=\"0.5\" data-step=\"0.1\" data-grid=\"true\" data-grid-num=\"10\" data-grid-snap=\"false\" data-prettify-separator=\",\" data-prettify-enabled=\"true\" data-keyboard=\"true\" data-data-type=\"number\"/>\n</div>")
})
```
Expand All @@ -231,7 +231,7 @@ The key idea of snapshot tests is to store the expected results in a separate fi
Here we use `expect_snapshot()` to capture the output displayed on the console:

```{r, eval = FALSE}
test_that("shinyInput01() creates expected HTML", {
test_that("sliderInput01() creates expected HTML", {
expect_snapshot(sliderInput01("x"))
})
```
Expand All @@ -242,7 +242,7 @@ If your code is in `R/slider.R` and your test is in `tests/testthat/test-slider.
The first time you run the test, `expect_snapshot()` will automatically create the reference output, which will look like this:

``` {.md}
# shinyInput01() creates expected HTML
# sliderInput01() creates expected HTML
Code
sliderInput01("x")
Expand Down

0 comments on commit 3f18818

Please sign in to comment.