Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit b2b6b2c

Browse files
authored
Merge pull request #179 from AnnMarieW/add-allow-prop-77
Add `allow` prop to html.Iframe
2 parents b993cd5 + 2264cd4 commit b2b6b2c

File tree

3 files changed

+55
-44
lines changed

3 files changed

+55
-44
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## UNRELEASED
66
### Fixed
7+
- [#179](https://github.com/plotly/dash-html-components/pull/178) - Fixes [#77](https://github.com/plotly/dash-html-components/issues/77) Added `allow` and `referrerPolicy` properties to `html.Iframe`
8+
79
- [#178](https://github.com/plotly/dash-html-components/pull/178) - Fix [#161](https://github.com/plotly/dash-html-components/issues/161) <object> `data` property, and fix [#129](https://github.com/plotly/dash-html-components/issues/129) obsolete, deprecated, and discouraged elements. No elements were removed, but comments were added to the documentation about these elements detailing their limitations.
810

911
## [1.1.2] - 2021-01-19

Diff for: scripts/extract-attributes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const htmlPath = './data/attributes.html';
1212
// From https://facebook.github.io/react/docs/tags-and-attributes.html#supported-attributes
1313
// less the special `className` and `htmlFor` props,
1414
// and `httpEquiv` + `acceptCharset` which are already correctly camelCased.
15-
const supportedAttributes = ['accept', 'accessKey', 'action',
15+
const supportedAttributes = ['accept', 'accessKey', 'action', 'allow',
1616
'allowFullScreen', 'allowTransparency', 'alt', 'async', 'autoComplete',
1717
'autoFocus', 'autoPlay', 'capture', 'cellPadding', 'cellSpacing', 'challenge',
1818
'charSet', 'checked', 'cite', 'classID', 'colSpan', 'cols', 'content',
@@ -25,8 +25,8 @@ const supportedAttributes = ['accept', 'accessKey', 'action',
2525
'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media',
2626
'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name',
2727
'noValidate', 'nonce', 'open', 'optimum', 'pattern', 'placeholder', 'poster',
28-
'preload', 'profile', 'radioGroup', 'readOnly', 'rel', 'required', 'reversed',
29-
'role', 'rowSpan', 'rows', 'sandbox', 'scope', 'scoped', 'scrolling',
28+
'preload', 'profile', 'radioGroup', 'readOnly', 'referrerPolicy', 'rel', 'required',
29+
'reversed', 'role', 'rowSpan', 'rows', 'sandbox', 'scope', 'scoped', 'scrolling',
3030
'seamless', 'selected', 'shape', 'size', 'sizes', 'span', 'spellCheck', 'src',
3131
'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'tabIndex',
3232
'target', 'title', 'type', 'useMap', 'value', 'width', 'wmode', 'wrap'];

Diff for: tests/test_integration.py

+50-41
Original file line numberDiff line numberDiff line change
@@ -7,93 +7,102 @@
77

88

99
def test_click_simple(dash_duo):
10-
call_count = Value('i', 0)
10+
call_count = Value("i", 0)
1111

1212
app = dash.Dash(__name__)
13-
app.layout = html.Div([
14-
html.Div(id='container'),
15-
html.Button('Click', id='button', n_clicks=0)
16-
])
17-
18-
@app.callback(Output('container', 'children'), Input('button', 'n_clicks'))
13+
app.layout = html.Div(
14+
[
15+
html.Div(id="container"),
16+
html.Button("Click", id="button", n_clicks=0),
17+
html.Iframe(id="video", allow="fullscreen", referrerPolicy="origin"),
18+
]
19+
)
20+
21+
@app.callback(Output("container", "children"), Input("button", "n_clicks"))
1922
def update_output(n_clicks):
2023
call_count.value += 1
21-
return 'clicked {} times'.format(n_clicks)
24+
return "clicked {} times".format(n_clicks)
2225

2326
dash_duo.start_server(app)
2427

25-
dash_duo.find_element('#container')
28+
dash_duo.find_element("#container")
2629

27-
dash_duo.wait_for_text_to_equal(
28-
'#container', 'clicked 0 times')
30+
dash_duo.wait_for_text_to_equal("#container", "clicked 0 times")
2931
assert call_count.value == 1
30-
dash_duo.percy_snapshot('button initialization')
32+
dash_duo.percy_snapshot("button initialization")
3133

32-
dash_duo.find_element('#button').click()
34+
dash_duo.find_element("#button").click()
3335

34-
dash_duo.wait_for_text_to_equal(
35-
'#container', 'clicked 1 times')
36+
dash_duo.wait_for_text_to_equal("#container", "clicked 1 times")
3637
assert call_count.value == 2
37-
dash_duo.percy_snapshot('button click')
38+
dash_duo.percy_snapshot("button click")
3839

3940
assert not dash_duo.get_logs()
4041

42+
assert dash_duo.find_element("#video").get_attribute("allow") == "fullscreen"
43+
assert dash_duo.find_element("#video").get_attribute("referrerpolicy") == "origin"
44+
4145

4246
def test_click_prev(dash_duo):
43-
call_count = Value('i', 0)
44-
timestamp_1 = Value('d', -5)
45-
timestamp_2 = Value('d', -5)
47+
call_count = Value("i", 0)
48+
timestamp_1 = Value("d", -5)
49+
timestamp_2 = Value("d", -5)
4650

4751
app = dash.Dash(__name__)
48-
app.layout = html.Div([
49-
html.Div(id='container'),
50-
html.Button('Click', id='button-1', n_clicks=0, n_clicks_timestamp=-1),
51-
html.Button('Click', id='button-2', n_clicks=0, n_clicks_timestamp=-1)
52-
])
52+
app.layout = html.Div(
53+
[
54+
html.Div(id="container"),
55+
html.Button("Click", id="button-1", n_clicks=0, n_clicks_timestamp=-1),
56+
html.Button("Click", id="button-2", n_clicks=0, n_clicks_timestamp=-1),
57+
]
58+
)
5359

5460
@app.callback(
55-
Output('container', 'children'),
56-
[Input('button-1', 'n_clicks'),
57-
Input('button-1', 'n_clicks_timestamp'),
58-
Input('button-2', 'n_clicks'),
59-
Input('button-2', 'n_clicks_timestamp')])
61+
Output("container", "children"),
62+
[
63+
Input("button-1", "n_clicks"),
64+
Input("button-1", "n_clicks_timestamp"),
65+
Input("button-2", "n_clicks"),
66+
Input("button-2", "n_clicks_timestamp"),
67+
],
68+
)
6069
def update_output(*args):
6170
print(args)
6271
call_count.value += 1
6372
timestamp_1.value = args[1]
6473
timestamp_2.value = args[3]
65-
return '{}, {}'.format(args[0], args[2])
74+
return "{}, {}".format(args[0], args[2])
6675

6776
dash_duo.start_server(app)
6877

69-
dash_duo.wait_for_text_to_equal('#container', '0, 0')
78+
dash_duo.wait_for_text_to_equal("#container", "0, 0")
7079
assert timestamp_1.value == -1
7180
assert timestamp_2.value == -1
7281
assert call_count.value == 1
73-
dash_duo.percy_snapshot('button initialization 1')
82+
dash_duo.percy_snapshot("button initialization 1")
7483

75-
dash_duo.find_element('#button-1').click()
76-
dash_duo.wait_for_text_to_equal('#container', '1, 0')
84+
dash_duo.find_element("#button-1").click()
85+
dash_duo.wait_for_text_to_equal("#container", "1, 0")
7786
assert timestamp_1.value > ((time.time() - (24 * 60 * 60)) * 1000)
7887
assert timestamp_2.value == -1
7988
assert call_count.value == 2
80-
dash_duo.percy_snapshot('button-1 click')
89+
dash_duo.percy_snapshot("button-1 click")
8190
prev_timestamp_1 = timestamp_1.value
8291

83-
dash_duo.find_element('#button-2').click()
84-
dash_duo.wait_for_text_to_equal('#container', '1, 1')
92+
dash_duo.find_element("#button-2").click()
93+
dash_duo.wait_for_text_to_equal("#container", "1, 1")
8594
assert timestamp_1.value == prev_timestamp_1
8695
assert timestamp_2.value > ((time.time() - 24 * 60 * 60) * 1000)
8796
assert call_count.value == 3
88-
dash_duo.percy_snapshot('button-2 click')
97+
dash_duo.percy_snapshot("button-2 click")
8998
prev_timestamp_2 = timestamp_2.value
9099

91-
dash_duo.find_element('#button-2').click()
92-
dash_duo.wait_for_text_to_equal('#container', '1, 2')
100+
dash_duo.find_element("#button-2").click()
101+
dash_duo.wait_for_text_to_equal("#container", "1, 2")
93102
assert timestamp_1.value == prev_timestamp_1
94103
assert timestamp_2.value > prev_timestamp_2
95104
assert timestamp_2.value > timestamp_1.value
96105
assert call_count.value == 4
97-
dash_duo.percy_snapshot('button-2 click again')
106+
dash_duo.percy_snapshot("button-2 click again")
98107

99108
assert not dash_duo.get_logs()

0 commit comments

Comments
 (0)