-
-
Notifications
You must be signed in to change notification settings - Fork 31
Provide support for multiple outputs #119
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
Merged
Merged
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a44050a
Provide support for no_update in Dash for R (#111)
rpkyle 2990c72
:sparkles: add createCallbackId
d476c91
:sparkles: add support for multiple outputs
b274c58
:rotating_light: add checks for multi-output callbacks
d77a0ce
:rotating_light: add test for multiple outputs
d26c4a2
:hammer: replace regex with strsplit
981ca3b
:bug: rename idlist to output_ids
10a04f4
:pencil2: updated comments
16fee5e
:hammer: support partial updates
83d3501
:rotating_light: add test for partial outputs
f1f4724
:rotating_light: add check for duplicated outputs
508eeb1
:sparkles: add insertIntoCallbackMap
df19ffe
modify R :package: install process
rpkyle b08eab6
:see_no_evil: fix quotation marks
rpkyle 30ba139
condense further, run R once to install :package:
rpkyle 5521a93
:rotating_light: for output=list, output=output
000fcbb
:hammer: fix missing argument
64dcfe3
:rotating_light: add test for repeated outputs
923116b
:tshirt: remove whitespace
787024e
:pencil2: update CircleCI config for unit tests
8146e5c
:pencil2: fix indent
542af5d
:pencil2: address test loading issue
029af1c
:rotating_light: test 1, 2 DashNoUpdate() els
f663327
Merge branch 'dev' into 114-multiple-outputs
rpkyle 8071866
:pencil2: add comments
32a2724
Merge branch '114-multiple-outputs' of github.com:plotly/dashR into 1…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
from selenium.webdriver.support.select import Select | ||
|
||
app = """ | ||
library(dash) | ||
library(dashHtmlComponents) | ||
library(dashCoreComponents) | ||
library(plotly) | ||
library(dashTable) | ||
|
||
app <- Dash$new() | ||
app$layout( | ||
htmlDiv(list( | ||
htmlDiv(list( | ||
htmlH1('Multi output example'), | ||
dccDropdown(id='data-dropdown', | ||
options = list( | ||
list(label = 'Movies', | ||
value = 'movies'), | ||
list(label = 'Series', | ||
value = 'series') | ||
), | ||
value = 'movies') | ||
), | ||
id = 'container', | ||
style = list( | ||
backgroundColor = '#ff998a' | ||
) | ||
), | ||
htmlDiv(list( | ||
htmlH2('Make a selection from the dropdown menu.', | ||
id = 'text-box'), | ||
dccRadioItems(id='radio-partial', | ||
options = list( | ||
list(label = 'All', | ||
value = 'all'), | ||
list(label = 'Do not update colour', | ||
value = 'static') | ||
), | ||
value = 'all') | ||
) | ||
) | ||
) | ||
) | ||
) | ||
app$callback(output=list( | ||
output(id='text-box', property='children'), | ||
output(id='container', property='style') | ||
), | ||
params=list( | ||
input(id='data-dropdown', property='value'), | ||
input(id='radio-partial', property='value') | ||
), | ||
function(value, choice) { | ||
if (is.null(value)) { | ||
return(dashNoUpdate()) | ||
} | ||
|
||
if (choice == "all" && value == "series") { | ||
style <- list( | ||
backgroundColor = '#ff998a' | ||
) | ||
} else if (choice == "all") { | ||
style <- list( | ||
backgroundColor = '#fff289' | ||
) | ||
} else { | ||
return(list(sprintf("You have chosen %s.", value), | ||
dashNoUpdate())) | ||
} | ||
|
||
return(list(sprintf("You have chosen %s.", value), | ||
style)) | ||
} | ||
) | ||
app$run_server(debug=TRUE) | ||
""" | ||
|
||
|
||
def test_rsnu001_multiple_outputs(dashr): | ||
dashr.start_server(app) | ||
dashr.find_element("#data-dropdown").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[1].click() | ||
dashr.wait_for_text_to_equal( | ||
"#text-box", | ||
"You have chosen series." | ||
) | ||
backgroundColor = dashr.find_element('#container').value_of_css_property("background-color") | ||
assert backgroundColor == "rgba(255, 153, 138, 1)" | ||
dashr.find_element("#data-dropdown").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[0].click() | ||
dashr.wait_for_text_to_equal( | ||
"#text-box", | ||
"You have chosen movies." | ||
) | ||
backgroundColor = dashr.find_element('#container').value_of_css_property("background-color") | ||
assert backgroundColor == "rgba(255, 242, 137, 1)" | ||
dashr.find_elements("input[type='radio']")[1].click() | ||
dashr.find_element("#data-dropdown").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[1].click() | ||
dashr.wait_for_text_to_equal( | ||
"#text-box", | ||
"You have chosen series." | ||
) | ||
assert backgroundColor == "rgba(255, 242, 137, 1)" | ||
dashr.find_elements("input[type='radio']")[0].click() | ||
dashr.find_element("#data-dropdown").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[0].click() | ||
dashr.wait_for_text_to_equal( | ||
"#text-box", | ||
"You have chosen movies." | ||
) | ||
assert backgroundColor == "rgba(255, 242, 137, 1)" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.