Skip to content

Commit

Permalink
Remove references to dash namespace within package
Browse files Browse the repository at this point in the history
  • Loading branch information
HammadTheOne committed Oct 7, 2021
1 parent 7c76953 commit d419517
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion R/dependencies.R
Expand Up @@ -12,7 +12,7 @@ setWildcardId <- function(id) {

#' Input/Output/State definitions
#'
#' Use in conjunction with the `callback()` method from the [dash::Dash] class
#' Use in conjunction with the `callback()` method from the [Dash] class
#' to define the update logic in your application.
#'
#' The `dashNoUpdate()` function permits application developers to prevent a
Expand Down
2 changes: 1 addition & 1 deletion R/simple_table.R
Expand Up @@ -7,7 +7,7 @@
#' if (interactive()) {
#' app <- dash_app() %>%
#' set_layout(
#' dash::dccChecklist(
#' dccChecklist(
#' id = "table_params",
#' labelStyle = list(display = "block"),
#' options = list(
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Expand Up @@ -1547,7 +1547,7 @@ is_dash_app <- function(x) {

assert_dash <- function(x) {
if (!is_dash_app(x)) {
stop("You must provide a Dash app object (created with `dash::Dash$new()` or `dash::dash_app()`)", call. = FALSE)
stop("You must provide a Dash app object (created with `Dash$new()` or `dash_app()`)", call. = FALSE)
}
invisible(TRUE)
}
Expand All @@ -1559,9 +1559,9 @@ componentify <- function(x) {
stop("dash: layout cannot include Shiny tags (you might have loaded the {shiny} package after loading {dash})", call. = FALSE)
} else if (is.list(x)) {
x <- remove_empty(x)
dash::htmlDiv(children = lapply(x, componentify))
htmlDiv(children = lapply(x, componentify))
} else if (length(x) == 1) {
dash::htmlSpan(children = x)
htmlSpan(children = x)
} else if (is.null(x)) {
return(NULL)
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/wrappers.R
Expand Up @@ -2,7 +2,7 @@

#' Create a Dash application
#'
#' This is a convenience function that returns a [`dash::Dash`] R6 object.
#' This is a convenience function that returns a [`Dash`] R6 object.
#' For advanced usage, you can use the object as an R6 object directly instead
#' of the functions provided by the `{dash}` package.
#'
Expand Down Expand Up @@ -60,7 +60,7 @@ dash_app <- function(title = NULL,
assets_ignore <- ""
}

app <- dash::Dash$new(
app <- Dash$new(
assets_folder = assets_folder,
assets_url_path = assets_url_path,
assets_ignore = assets_ignore,
Expand Down
2 changes: 1 addition & 1 deletion man/simple_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/manual/callbacks-simple.R
Expand Up @@ -2,7 +2,7 @@ library(dash)

dash_app() %>%
set_layout(
dash::dccInput(id = "text", "sample"),
dccInput(id = "text", "sample"),
div("CAPS: ", span(id = "out1")),
div("small: ", span(id = "out2"))
) %>%
Expand Down
48 changes: 24 additions & 24 deletions tests/testthat/test-layout.R
Expand Up @@ -41,14 +41,14 @@ test_that("Layout errors", {
test_that("Layout basics", {
expect_identical(
set_get_layout_new(div("one"), h2("two")),
set_get_layout_old(dash::htmlDiv(list(
dash::htmlDiv("one"), dash::htmlH2("two")
set_get_layout_old(htmlDiv(list(
htmlDiv("one"), htmlH2("two")
)))
)
expect_identical(set_get_layout_new("one", "two"), set_get_layout_new(list("one", "two")))
expect_identical(
set_get_layout_new(function() div("one", "two")),
set_get_layout_old(function() dash::htmlDiv(list("one", "two")))
set_get_layout_old(function() htmlDiv(list("one", "two")))
)
})

Expand All @@ -75,15 +75,15 @@ test_that("No need to place everything in containers and lists", {
expect_error(set_get_layout_old("test"))
expect_identical(
set_get_layout_new(div("one", "two")),
set_get_layout_old(dash::htmlDiv(list("one", "two")))
set_get_layout_old(htmlDiv(list("one", "two")))
)
expect_identical(set_get_layout_new("test"), set_get_layout_old(dash::htmlSpan("test")))
expect_identical(set_get_layout_new("test"), set_get_layout_old(htmlSpan("test")))
expect_identical(
set_get_layout_new("one", 5, TRUE),
set_get_layout_old(dash::htmlDiv(list(
dash::htmlSpan("one"),
dash::htmlSpan(5),
dash::htmlSpan(TRUE)
set_get_layout_old(htmlDiv(list(
htmlSpan("one"),
htmlSpan(5),
htmlSpan(TRUE)
)))
)
})
Expand All @@ -101,7 +101,7 @@ test_that("Function as layout works", {
app2 <- Dash$new()
set.seed(1000)
runif(1)
app2$layout(dash::htmlDiv(runif(1)))
app2$layout(htmlDiv(runif(1)))
app2_layout <- app2$layout_get()
expect_identical(app1_layout1, app2_layout)

Expand All @@ -114,7 +114,7 @@ test_that("Function as layout works", {
expect_false(identical(app1_fx_layout1, app1_fx_layout2))
app2_fx <- Dash$new()
set.seed(1000)
app2_fx$layout(function() dash::htmlDiv(runif(1)))
app2_fx$layout(function() htmlDiv(runif(1)))
app2_fx_layout1 <- app2_fx$layout_get()
app2_fx_layout2 <- app2_fx$layout_get()
expect_identical(app1_fx_layout1, app2_fx_layout1)
Expand All @@ -124,19 +124,19 @@ test_that("Function as layout works", {
test_that("Sample apps layout are identical with the compact syntax", {
expect_identical(
set_get_layout_old(
dash::htmlDiv(list(
dash::htmlDiv('Dash To-Do List'),
dash::dccInput(id = 'new-item'),
dash::htmlButton("Add", id = "add"),
dash::htmlButton("Clear Done", id = "clear-done"),
dash::htmlDiv(id = "list-container"),
dash::htmlDiv(id = "totals")
htmlDiv(list(
htmlDiv('Dash To-Do List'),
dccInput(id = 'new-item'),
htmlButton("Add", id = "add"),
htmlButton("Clear Done", id = "clear-done"),
htmlDiv(id = "list-container"),
htmlDiv(id = "totals")
))
),

set_get_layout_new(
div('Dash To-Do List'),
dash::dccInput(id = 'new-item'),
dccInput(id = 'new-item'),
button("Add", id = "add"),
button("Clear Done", id = "clear-done"),
div(id = "list-container"),
Expand All @@ -146,11 +146,11 @@ test_that("Sample apps layout are identical with the compact syntax", {

expect_identical(
set_get_layout_old(
dash::htmlDiv(
htmlDiv(
list(
dash::htmlH1('Hello Dash'),
dash::htmlDiv(children = "Dash: A web application framework for R."),
dash::dccGraph(
htmlH1('Hello Dash'),
htmlDiv(children = "Dash: A web application framework for R."),
dccGraph(
figure=list(
data=list(
list(
Expand All @@ -176,7 +176,7 @@ test_that("Sample apps layout are identical with the compact syntax", {
set_get_layout_new(
h1('Hello Dash'),
div("Dash: A web application framework for R."),
dash::dccGraph(
dccGraph(
figure=list(
data=list(
list(
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test-tags.R
@@ -1,24 +1,24 @@
context("tags")

test_that("Tag basics", {
expect_identical(div("a", "b"), dash::htmlDiv(list("a", "b")))
expect_identical(div("a", "b", 5), dash::htmlDiv(list("a", "b", 5)))
expect_identical(div("a", "b", 5, id = "test"), dash::htmlDiv(list("a", "b", 5), id = "test"))
expect_identical(div("a", "b"), htmlDiv(list("a", "b")))
expect_identical(div("a", "b", 5), htmlDiv(list("a", "b", 5)))
expect_identical(div("a", "b", 5, id = "test"), htmlDiv(list("a", "b", 5), id = "test"))
expect_identical(
span("a", 5, id = "test", "b", className = "foo"),
dash::htmlSpan(list("a", 5, "b"), id = "test", className = "foo")
htmlSpan(list("a", 5, "b"), id = "test", className = "foo")
)
expect_identical(
div(span("test"), dash::dccInput("input")),
dash::htmlDiv(list(dash::htmlSpan("test"), dash::dccInput("input")))
div(span("test"), dccInput("input")),
htmlDiv(list(htmlSpan("test"), dccInput("input")))
)
})

test_that("No children", {
expect_identical(div(), dash::htmlDiv())
expect_identical(div(list()), dash::htmlDiv(children = list()))
expect_identical(div(), htmlDiv())
expect_identical(div(list()), htmlDiv(children = list()))
expect_false(identical(div(), div(list())))
expect_identical(div(id = "test"), dash::htmlDiv(id = "test"))
expect_identical(div(id = "test"), htmlDiv(id = "test"))
})

test_that("Illegal attributes", {
Expand All @@ -28,9 +28,9 @@ test_that("Illegal attributes", {
})

test_that("Single child is not a list", {
expect_identical(div("a"), dash::htmlDiv("a"))
expect_identical(div("a"), htmlDiv("a"))
expect_false(identical(div("a"), div(list("a"))))
expect_identical(div(list("a", "b")), dash::htmlDiv(list("a", "b")))
expect_identical(div(list("a", "b")), htmlDiv(list("a", "b")))
})

test_that("Boolean and NULL attributes", {
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-utils.R
Expand Up @@ -29,8 +29,8 @@ test_that("componentify basics", {
div("foo")
)
expect_identical(
componentify(dash::dccInput("foo", "bar")),
dash::dccInput("foo", "bar")
componentify(dccInput("foo", "bar")),
dccInput("foo", "bar")
)
})

Expand Down Expand Up @@ -59,10 +59,10 @@ test_that("componentify list", {
div(span("foo"), span("bar"))
)
expect_identical(
componentify(list("foo", dash::dccInput("foo", "bar"), 10, div("bar"))),
componentify(list("foo", dccInput("foo", "bar"), 10, div("bar"))),
div(
span("foo"),
dash::dccInput("foo", "bar"),
dccInput("foo", "bar"),
span(10),
div("bar")
)
Expand Down

0 comments on commit d419517

Please sign in to comment.