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

Commit 78aaeda

Browse files
author
Shammamah Hossain
committed
Add percy snapshot to test and fix window override test.
1 parent 3ebf656 commit 78aaeda

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/integration/misc/test_markdown_highlight.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import dash
4+
from dash.dependencies import Input, Output
45
import dash_core_components as dcc
56
import dash_html_components as html
67

@@ -20,9 +21,25 @@ def test_msmh001_no_window_variable(dash_dcc):
2021
assert window_hljs is None
2122

2223

23-
def test_msmh001_window_override(dash_dcc):
24+
def test_msmh002_window_override(dash_dcc):
2425
app = dash.Dash(__name__)
25-
app.layout = html.Div(dcc.Markdown(md_text))
26+
app.layout = html.Div([
27+
html.Div(id='md-trigger'),
28+
html.Div(id='md-container')
29+
])
30+
31+
# we can't run the script below until after the page has loaded,
32+
# so we need to trigger a rerender of the markdown component
33+
@app.callback(
34+
Output('md-container', 'children'),
35+
[Input('md-trigger', 'children')]
36+
)
37+
def trigger_md_rerender(_):
38+
return dcc.Markdown(md_text)
39+
2640
dash_dcc.start_server(app)
2741

2842
dash_dcc.driver.execute_script('window.hljs = {highlightBlock: (block) => {block.innerHTML="hljs override"}};')
43+
44+
assert dash_dcc.find_element('code').text == 'hljs override'
45+
dash_dcc.percy_snapshot('md_code_highlight_override')

0 commit comments

Comments
 (0)