-
-
Notifications
You must be signed in to change notification settings - Fork 31
Provide support for no_update in Dash for R #111
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 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4a041cf
:sparkles: add support for no_update
bfe9cbb
:bug: use = instead of <- in method desc
b23c248
:pencil2: :books: no_update -> dashNoUpdate, docs
d1f384f
:sparkles: add test for dashNoUpdate()
ae7b1b0
:bug: properly handle outputs with len > 1
01bc431
:hocho: whitespace
10404e0
:hocho: extraneous :books:
8f6dafd
:rotating_light: added test
9971c63
:see_no_evil: :hocho: cache age param
e587263
:bug: corrected id
be9d387
replace time.sleep with wait for text
b75c49a
:hocho: redundant assert
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,63 @@ | ||
from selenium.webdriver.support.select import Select | ||
|
||
app = """ | ||
library(dash) | ||
library(dashHtmlComponents) | ||
library(dashCoreComponents) | ||
|
||
app <- Dash$new() | ||
|
||
app$layout( | ||
htmlDiv(list( | ||
dccDropdown(options = list( | ||
list(label = "Red", value = "#FF0000"), | ||
list(label = "Green", value = "#00FF00"), | ||
list(label = "Blue", value = "#0000FF"), | ||
list(label = "Do nothing", value = "nothing") | ||
), | ||
id = "color-selector"), | ||
htmlDiv(id='message-box', | ||
children='Please select a colour choice from the dropdown menu.') | ||
) | ||
) | ||
) | ||
|
||
app$callback(output=list(id='message-box', property='children'), | ||
params=list( | ||
input(id='color-selector', property='value')), | ||
function(color) | ||
{ | ||
if (color %in% c("#FF0000", "#00FF00", "#0000FF")) { | ||
msg <- sprintf("The hexadecimal representation of your last chosen colour is %s", | ||
color) | ||
return(msg) | ||
} else { | ||
return(dashNoUpdate()) | ||
} | ||
} | ||
) | ||
|
||
app$run_server() | ||
""" | ||
|
||
|
||
def test_rsnu001_no_update(dashr): | ||
dashr.start_server(app) | ||
dashr.find_element("#color-selector").click() | ||
alexcjohnson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dashr.find_elements("div.VirtualizedSelectOption")[0].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #FF0000" | ||
dashr.find_element("#color-selector").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[3].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #FF0000" | ||
dashr.find_element("#color-selector").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[1].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #00FF00" | ||
dashr.find_element("#color-selector").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[3].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #00FF00" | ||
dashr.find_element("#color-selector").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[2].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #0000FF" | ||
dashr.find_element("#color-selector").click() | ||
dashr.find_elements("div.VirtualizedSelectOption")[3].click() | ||
assert dashr.find_element("#message-box").text == "The hexadecimal representation of your last chosen colour is #0000FF" |
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.