-
Notifications
You must be signed in to change notification settings - Fork 636
Fix. Account for the "data_array" property of the "values" attribute of the "dimensions" attribute. Closes #2385 #2387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -551,7 +551,15 @@ verify_attr <- function(proposed, schema, layoutAttr = FALSE) { | |
|
||
# do the same for "sub-attributes" | ||
if (identical(role, "object") && is.recursive(proposed[[attr]])) { | ||
proposed[[attr]] <- verify_attr(proposed[[attr]], attrSchema, layoutAttr = layoutAttr) | ||
# The "dimensions" attribute requires a special treatment as | ||
# it is an unnamed list and hence will be skipped by `for (attr in names(proposed)) | ||
if (attr == "dimensions") { | ||
|
||
proposed[[attr]] <- lapply(proposed[[attr]], \(x) { | ||
|
||
verify_attr(x, attrSchema$items$dimension, layoutAttr = layoutAttr) | ||
}) | ||
} else { | ||
proposed[[attr]] <- verify_attr(proposed[[attr]], attrSchema, layoutAttr = layoutAttr) | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
expect_traces <- function(p, n.traces, name) { | ||
stopifnot(is.numeric(n.traces)) | ||
L <- expect_doppelganger_built(p, paste0("plotly-", name)) | ||
expect_equivalent(length(L$data), n.traces) | ||
L | ||
} | ||
|
||
test_that("values property has a class of AsIs", { | ||
p <- plot_ly( | ||
dimensions = list( | ||
list(values = "A"), | ||
list(values = "B") | ||
), | ||
type = "parcats" | ||
) | ||
l <- expect_traces(p, 1, "parcats-data-array") | ||
tr <- l$data[[1]]$dimensions | ||
expect_true(inherits(tr[[1]]$values, "AsIs")) | ||
expect_true(inherits(tr[[2]]$values, "AsIs")) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
expect_traces <- function(p, n.traces, name) { | ||
stopifnot(is.numeric(n.traces)) | ||
L <- expect_doppelganger_built(p, paste0("plotly-", name)) | ||
expect_equivalent(length(L$data), n.traces) | ||
L | ||
} | ||
|
||
test_that("values property has a class of AsIs", { | ||
p <- plot_ly( | ||
dimensions = list( | ||
list(label = "A", values = 3), | ||
list(label = "B", values = 8) | ||
), | ||
type = "parcoords" | ||
) | ||
l <- expect_traces(p, 1, "parcoords-data-array") | ||
tr <- l$data[[1]]$dimensions | ||
expect_true(inherits(tr[[1]]$values, "AsIs")) | ||
expect_true(inherits(tr[[2]]$values, "AsIs")) | ||
}) |
Uh oh!
There was an error while loading. Please reload this page.