Skip to content

Commit b4b8619

Browse files
committed
added changelog and test
1 parent cffac43 commit b4b8619

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
55
## [UNRELEASED]
66

77
## Added
8+
- [#3568]((https://github.com/plotly/dash/pull/3568) Added `children` and `copied_children` props to `dcc.Clipboard` to customize the button contents before and after copying.
89
- [#3534]((https://github.com/plotly/dash/pull/3534) Adds `playsInline` prop to `html.Video`. Based on [#2338]((https://github.com/plotly/dash/pull/2338)
910
- [#3541](https://github.com/plotly/dash/pull/3541) Add `attributes` dictionary to be be formatted on script/link (_js_dist/_css_dist) tags of the index, allows for `type="module"` or `type="importmap"`. [#3538](https://github.com/plotly/dash/issues/3538)
1011

components/dash-core-components/tests/integration/clipboard/test_clipboard.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,46 @@ def selected(icon_clicks, button_clicks):
9090
== copy_text,
9191
timeout=3,
9292
)
93+
94+
95+
def test_clp004_clipboard_children_and_copied_children(dash_dcc_headed):
96+
content = "https://dash.plotly.com/"
97+
children_text = "Copy URL"
98+
copied_children_text = "Copied!"
99+
100+
app = Dash(__name__, prevent_initial_callbacks=True)
101+
app.layout = html.Div(
102+
[
103+
dcc.Clipboard(
104+
id="clipboard",
105+
children=children_text,
106+
copied_children=copied_children_text,
107+
content=content,
108+
),
109+
dcc.Textarea(id="textarea"),
110+
]
111+
)
112+
113+
dash_dcc_headed.start_server(app)
114+
115+
clipboard = dash_dcc_headed.find_element("#clipboard")
116+
117+
assert clipboard.text == children_text
118+
119+
clipboard.click()
120+
wait.until(
121+
lambda: dash_dcc_headed.find_element("#clipboard").text == copied_children_text,
122+
timeout=3,
123+
)
124+
textarea = dash_dcc_headed.find_element("#textarea")
125+
textarea.click()
126+
127+
ActionChains(dash_dcc_headed.driver).key_down(Keys.CONTROL).send_keys("v").key_up(
128+
Keys.CONTROL
129+
).perform()
130+
131+
wait.until(
132+
lambda: dash_dcc_headed.find_element("#textarea").get_attribute("value")
133+
== content,
134+
timeout=3,
135+
)

0 commit comments

Comments
 (0)