File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ import json
1
2
from multiprocessing import Value
2
3
import datetime
3
4
import itertools
@@ -344,3 +345,51 @@ def test_index_customization(self):
344
345
self .assertEqual ('Got added' , add .text )
345
346
346
347
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' )
You can’t perform that action at this time.
0 commit comments