forked from plotly/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add standard dash interface for location change (plotly#1094) * feat: disable cookie access under restricted sandboxes (plotly#1080) * IE11 compatibility (plotly#1106) * Add `inheritAsyncDecorator` for wrapper components (plotly#1109) * bump version, loosen version requirements * dcc>=1.7.0, 1.7.1 was JS only * stricten versions * stricten table version Co-authored-by: Marc-André Rivet <Marc-Andre-Rivet@users.noreply.github.com> Co-authored-by: Jose Diaz-Gonzalez <email@josediazgonzalez.com>
- Loading branch information
1 parent
c2d6dce
commit dcf5720
Showing
16 changed files
with
137 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 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,13 @@ | ||
const ON_CHANGE = '_dashprivate_historychange'; | ||
|
||
export default class History { | ||
static dispatchChangeEvent() { | ||
window.dispatchEvent(new CustomEvent(ON_CHANGE)); | ||
} | ||
|
||
static onChange(listener) { | ||
window.addEventListener(ON_CHANGE, listener); | ||
|
||
return () => window.removeEventListener(ON_CHANGE, listener); | ||
} | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { asyncDecorator, isReady } from './dynamicImport'; | ||
import { asyncDecorator, inheritAsyncDecorator, isReady } from './dynamicImport'; | ||
import History from './History'; | ||
|
||
export { asyncDecorator, isReady }; | ||
export { asyncDecorator, inheritAsyncDecorator, isReady }; | ||
export { History }; |
This file contains 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 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 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 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '1.8.0' | ||
__version__ = '1.9.0' |
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Flask>=1.0.2 | ||
flask-compress | ||
plotly | ||
dash_renderer==1.2.3 | ||
dash-core-components==1.7.0 | ||
dash_renderer==1.2.4 | ||
dash-core-components==1.8.0 | ||
dash-html-components==1.0.2 | ||
dash-table==4.6.0 | ||
future |
This file contains 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,57 @@ | ||
from multiprocessing import Value | ||
|
||
import dash | ||
from dash.dependencies import Input, Output | ||
from dash.exceptions import PreventUpdate | ||
|
||
import dash_html_components as html | ||
|
||
|
||
def test_rdif001_sandbox_allow_scripts(dash_duo): | ||
app = dash.Dash(__name__) | ||
call_count = Value("i") | ||
|
||
N_OUTPUTS = 50 | ||
|
||
app.layout = html.Div([ | ||
html.Button("click me", id="btn"), | ||
] + [html.Div(id="output-{}".format(i)) for i in range(N_OUTPUTS)]) | ||
|
||
@app.callback( | ||
[Output("output-{}".format(i), "children") for i in range(N_OUTPUTS)], | ||
[Input("btn", "n_clicks")] | ||
) | ||
def update_output(n_clicks): | ||
if n_clicks is None: | ||
raise PreventUpdate | ||
|
||
call_count.value += 1 | ||
return ["{}={}".format(i, i + n_clicks) for i in range(N_OUTPUTS)] | ||
|
||
@app.server.after_request | ||
def apply_cors(response): | ||
response.headers["Access-Control-Allow-Origin"] = "*" | ||
response.headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Authorization" | ||
return response | ||
|
||
dash_duo.start_server(app) | ||
|
||
iframe = """ | ||
<!DOCTYPE html> | ||
<html> | ||
<iframe src="{0}" sandbox="allow-scripts"> | ||
</iframe> | ||
</html> | ||
""" | ||
|
||
html_content = iframe.format(dash_duo.server_url) | ||
|
||
dash_duo.driver.get("data:text/html;charset=utf-8," + html_content) | ||
|
||
dash_duo.driver.switch_to.frame(0) | ||
|
||
dash_duo.wait_for_element('#output-0') | ||
dash_duo.wait_for_element_by_id('btn').click() | ||
dash_duo.wait_for_element('#output-0').text == '0=1' | ||
|
||
assert len(dash_duo.get_logs()) != 0 |