Skip to content

Commit 0ba032b

Browse files
committed
Add test for assets.
1 parent ff1cff3 commit 0ba032b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Diff for: tests/test_integration.py

+49
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from multiprocessing import Value
23
import datetime
34
import itertools
@@ -344,3 +345,51 @@ def test_index_customization(self):
344345
self.assertEqual('Got added', add.text)
345346

346347
self.percy_snapshot('custom-index')
348+
349+
def test_assets(self):
350+
app = dash.Dash(assets_folder='tests/assets')
351+
app.index_string = '''
352+
<!DOCTYPE html>
353+
<html>
354+
<head>
355+
{metas}
356+
<title>{title}</title>
357+
{css}
358+
</head>
359+
<body>
360+
<div id="tested"></div>
361+
{app_entry}
362+
<footer>
363+
{config}
364+
{scripts}
365+
</footer>
366+
</body>
367+
</html>
368+
'''
369+
370+
app.layout = html.Div([
371+
html.Div(id='content'),
372+
dcc.Input(id='test')
373+
], id='layout')
374+
375+
self.startServer(app)
376+
377+
body = self.driver.find_element_by_tag_name('body')
378+
379+
body_margin = body.value_of_css_property('margin')
380+
self.assertEqual('0px', body_margin)
381+
382+
content = self.wait_for_element_by_id('content')
383+
content_padding = content.value_of_css_property('padding')
384+
self.assertEqual('8px', content_padding)
385+
386+
tested = self.wait_for_element_by_id('tested')
387+
tested = json.loads(tested.text)
388+
self.assertEqual(3, len(tested))
389+
390+
order = ('load_first', 'load_after', 'load_after1')
391+
392+
for i in range(3):
393+
self.assertEqual(order[i], tested[i])
394+
395+
self.percy_snapshot('test assets includes')

0 commit comments

Comments
 (0)