This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Document discouraged elements, and fix ObjectEl data #178
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f7e588b
fix ObjectEl data prop
alexcjohnson fcb414e
add deprecation notes on some elements, and fix for a few more change…
alexcjohnson 5d1eebe
update tests, and add tests for custom docs and ObjectEl
alexcjohnson 72796c4
move percy to py37 and separate out finalize step
alexcjohnson ec661f0
more test cleanup
alexcjohnson 4b7073e
one more try to combine percy snapshots
alexcjohnson 258eaf4
changelog for #178
alexcjohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
"postbuild": "es-check es5 dash_html_components/*.js", | ||
"build:watch": "watch 'npm run build' src", | ||
"test:import": "python -m unittest tests.test_dash_import", | ||
"test:py": "python -m unittest tests.test_dash_html_components tests.test_integration", | ||
"test:py": "pytest --nopercyfinalize --headless tests/test_dash_html_components.py tests/test_integration.py", | ||
"test": "run-s -c test:py test:import lint" | ||
}, | ||
"author": "Chris Parmer <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
import unittest | ||
import dash_html_components | ||
|
||
|
||
class TestDashHtmlComponents(unittest.TestCase): | ||
def test_imports(self): | ||
with open('./scripts/data/elements.txt') as f: | ||
elements = [ | ||
s[0].upper() + s[1:] for s in | ||
f.read().split('\n') | ||
] | ||
elements += ['MapEl', 'ObjectEl'] | ||
for s in ['Map', 'Object']: | ||
elements.remove(s) | ||
|
||
print(dir(dash_html_components)) | ||
|
||
self.assertEqual( | ||
set([d for d in dir(dash_html_components) if d[0] != '_' and d[0] == d[0].capitalize()]), | ||
set(elements) | ||
) | ||
|
||
def test_sample_items(self): | ||
Div = dash_html_components.Div | ||
Img = dash_html_components.Img | ||
|
||
layout = Div( | ||
Div( | ||
Img(src='https://plotly.com/~chris/1638.png') | ||
), style={'color': 'red'} | ||
) | ||
|
||
self.assertEqual( | ||
repr(layout), | ||
''.join([ | ||
"Div(children=Div(Img(src='https://plotly.com/~chris/1638.png')), " | ||
"style={'color': 'red'})" | ||
]) | ||
) | ||
|
||
self.assertEqual( | ||
layout._namespace, 'dash_html_components' | ||
) | ||
import pytest | ||
import dash_html_components as html | ||
|
||
|
||
def test_imports(): | ||
with open("./scripts/data/elements.txt") as f: | ||
elements = [s[0].upper() + s[1:] for s in f.read().split("\n")] | ||
elements += ["MapEl", "ObjectEl"] | ||
for s in ["Map", "Object"]: | ||
elements.remove(s) | ||
|
||
dir_set = set( | ||
[ | ||
d | ||
for d in dir(html) | ||
if d[0] != "_" and d[0] == d[0].capitalize() | ||
] | ||
) | ||
assert dir_set == set(elements) | ||
|
||
|
||
def test_sample_items(): | ||
layout = html.Div( | ||
html.Div(html.Img(src="https://plotly.com/~chris/1638.png")), | ||
style={"color": "red"} | ||
) | ||
|
||
expected = ( | ||
"Div(children=Div(Img(src='https://plotly.com/~chris/1638.png')), " | ||
"style={'color': 'red'})" | ||
) | ||
assert repr(layout) == expected | ||
|
||
assert layout._namespace == "dash_html_components" | ||
|
||
|
||
def test_objectEl(): | ||
layout = html.ObjectEl(data="something", **{"data-x": "else"}) | ||
assert repr(layout) == "ObjectEl(data='something', data-x='else')" | ||
|
||
with pytest.raises(TypeError): | ||
html.ObjectEl(datax="something") | ||
|
||
|
||
def test_customDocs(): | ||
assert "CAUTION" in html.Script.__doc__[:100] | ||
assert "OBSOLETE" in html.Blink.__doc__[:100] | ||
assert "DEPRECATED" in html.Marquee.__doc__[:100] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️