Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
277a236
Alert
tcbegley Aug 13, 2021
e90cbe6
Badge
tcbegley Aug 13, 2021
e778c16
Button
tcbegley Aug 13, 2021
ebb6f07
ButtonGroup
tcbegley Aug 13, 2021
63fc30d
Carousel
tcbegley Aug 13, 2021
4fa4b02
Collapse
tcbegley Aug 13, 2021
1edb13e
Fade
tcbegley Aug 14, 2021
fb7d43e
Add shim for html components that don't have class_name defined yet
tcbegley Aug 15, 2021
c44f53c
Update block button docs
tcbegley Aug 15, 2021
7123398
Update docs for Bootstrap 5
tcbegley Aug 15, 2021
cf68a38
RIP Jumbotron
tcbegley Aug 15, 2021
ac33e0e
Add react-bootstrap beta
tcbegley Aug 15, 2021
5c5af30
Layout
tcbegley Aug 15, 2021
54148ef
Docs fix
tcbegley Aug 15, 2021
6134398
Label
tcbegley Aug 15, 2021
c8c2949
Clean up example
tcbegley Aug 15, 2021
5f780b0
Monkeypatch doc tests
tcbegley Aug 15, 2021
42403e3
New components - Offcanvas and pagination (#643)
glsdown Aug 15, 2021
3412cca
Progress
tcbegley Aug 15, 2021
226791f
Format tests
tcbegley Aug 15, 2021
164207f
Spinner
tcbegley Aug 15, 2021
98d44e7
Table
tcbegley Aug 15, 2021
1f81d56
Toast
tcbegley Aug 15, 2021
793b3c1
New component Accordion (#645)
glsdown Aug 15, 2021
2b33232
flake8 config
tcbegley Aug 15, 2021
67dd011
List group updated to Bootstrap 5 (#647)
glsdown Aug 16, 2021
14fdeed
Bug fixes
tcbegley Aug 16, 2021
285e284
Tabs
tcbegley Aug 16, 2021
717d7b7
Form
tcbegley Aug 16, 2021
38a562e
Form updates + examples
tcbegley Aug 17, 2021
bfd42b0
Checklist / RadioItems
tcbegley Aug 18, 2021
a857394
Select
tcbegley Aug 18, 2021
ab47de0
themes
tcbegley Aug 18, 2021
a65f47e
BS5 updates for docs
tcbegley Aug 18, 2021
5fc033a
Fix doc tests
tcbegley Aug 18, 2021
e4c29bb
InputGroup
tcbegley Aug 18, 2021
80e5d36
Fix JS tests
tcbegley Aug 18, 2021
f9b53af
Checkbox/Radio
tcbegley Aug 18, 2021
5aea7e3
format js
tcbegley Aug 18, 2021
1ef7b40
Modal
tcbegley Aug 18, 2021
506a000
Modal docs
tcbegley Aug 18, 2021
b0ed5a4
Fix format command
tcbegley Aug 19, 2021
932cb0a
Card, Nav and Navbar (#648)
AnnMarieW Aug 20, 2021
bc22e9e
DropdownMenu
tcbegley Aug 20, 2021
d4d760d
NavbarToggler
tcbegley Aug 21, 2021
57716c6
Tooltip+Popover
tcbegley Aug 21, 2021
ce07d3e
Consistent imports
tcbegley Aug 21, 2021
d70f885
Fix accordion tests
tcbegley Aug 22, 2021
8431e7d
Initial breadcrumb component
tcbegley Aug 22, 2021
47dced1
Set accordion to first component
tcbegley Aug 22, 2021
3151b6a
Format code
tcbegley Aug 22, 2021
a0aef08
Update Breadcrumb
tcbegley Aug 22, 2021
dee3f2a
Snippet test fixes for breadcrumb
tcbegley Aug 22, 2021
b66ca58
Moved js components into individual folders
tcbegley Aug 22, 2021
4affffd
Fixes for layout and callback tests
glsdown Aug 23, 2021
d47d2f2
Formatting of R and julia snippets
glsdown Aug 23, 2021
c10b2a0
Updated js testing libraries
glsdown Aug 23, 2021
9711dac
Added recommended hack for react testing
glsdown Aug 23, 2021
def7dfd
Removed dup test and updated
glsdown Aug 23, 2021
58cd085
Carousel improvements
tcbegley Aug 23, 2021
6ab210a
Reverted to older testing packages
glsdown Aug 23, 2021
83f6364
Added component landing page
glsdown Aug 23, 2021
b3c2822
Removed callback from accordion & pagination simple
glsdown Aug 23, 2021
437bb89
Removed accordion from collapse
glsdown Aug 23, 2021
8b1bf96
Added listgroup flush example
glsdown Aug 23, 2021
cb38f77
Fixed accordion and pagination examples
glsdown Aug 23, 2021
aff10c0
Added coloured table
glsdown Aug 23, 2021
747f53c
Added dark variant carousel
glsdown Aug 23, 2021
f22512c
Added Table from multi-level dataframe
glsdown Aug 23, 2021
e9f9efe
Added multi input_group addons
glsdown Aug 23, 2021
58c1f63
Fixed issues with badge examples
glsdown Aug 23, 2021
d214f54
Docs first section to Examples
glsdown Aug 23, 2021
aa3c37c
Clean-up Tooltip code + tests
tcbegley Aug 23, 2021
d32a73f
Revert version numbers
tcbegley Aug 23, 2021
f42cd5a
Format
tcbegley Aug 23, 2021
08bc47b
Update setup.cfg
tcbegley Aug 23, 2021
1e6a752
Merge branch 'v1' into tidy-and-repair
tcbegley Aug 24, 2021
7a65551
Tidy up following merge
tcbegley Aug 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion docs/components_page/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def register_apps():
"input_group": {"markdown_path": COMPONENTS / "input_group.md"},
"layout": {"markdown_path": COMPONENTS / "layout.md"},
"list_group": {"markdown_path": COMPONENTS / "list_group.md"},
"main": {"markdown_path": COMPONENTS / "main.md"},
"modal": {
"markdown_path": COMPONENTS / "modal.md",
"extra_env_vars": {"LOREM": LOREM},
Expand Down Expand Up @@ -149,7 +150,6 @@ def register_apps():
},
{"name": "themes", "href": "/docs/themes", "label": "Themes"},
{"name": "faq", "href": "/docs/faq", "label": "FAQ"},
{"name": "dashr", "href": "/docs/dashr", "label": "Dash for R"},
{
"name": "components",
"href": "/docs/components",
Expand All @@ -161,6 +161,7 @@ def register_apps():
"label": _get_label(slug),
}
for slug in component_bodies
if _get_label(slug) != "Main"
],
},
]
Expand Down
45 changes: 30 additions & 15 deletions docs/components_page/components/__tests__/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ def py_source_to_app(py_source, env):
"""
env = env or {}
# TODO: remove class_name modifiers
exec(py_source.replace("class_name", "className"), env)
exec(
py_source.replace("class_name", "className").replace(
"_className", "_class_name"
),
env,
)
return env["app"]


Expand Down Expand Up @@ -52,21 +57,31 @@ def rename_variable(snippet_path, suffix, variable, assign_op="="):
return "\n".join(new_lines)


def load_r_app(path, component_name):
return R_WRAPPER.format(
snippet=path.read_text(),
components=component_name,
port=8050,
).replace(
"class_name", "className"
def load_r_app(path, component_name, extra_args=""):
snippet = path.read_text()
if extra_args:
snippet = f"{extra_args}\n{snippet}"
return (
R_WRAPPER.format(
snippet=snippet,
components=component_name,
port=8050,
)
.replace("class_name", "className")
.replace("_className", "_class_name")
) # TODO: remove this in future


def load_jl_app(path, component_name):
return JL_WRAPPER.format(
snippet=path.read_text(),
components=component_name,
port=8050,
).replace(
"class_name", "className"
def load_jl_app(path, component_name, extra_args=""):
snippet = path.read_text()
if extra_args:
snippet = f"{extra_args}\n{snippet}"
return (
JL_WRAPPER.format(
snippet=snippet,
components=component_name,
port=8050,
)
.replace("class_name", "className")
.replace("_className", "_class_name")
) # TODO: remove this in future
16 changes: 7 additions & 9 deletions docs/components_page/components/__tests__/test_accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@
HERE = Path(__file__).parent


def test_r_simple(dashr):
r_app = load_r_app((HERE.parent / "accordion" / "simple.R"), "accordion")
def test_r_callback(dashr):
r_app = load_r_app((HERE.parent / "accordion" / "callback.R"), "accordion")
dashr.start_server(r_app)
check_simple_callbacks(dashr)
check_callback_callbacks(dashr)


def test_jl_simple(dashjl):
def test_jl_callback(dashjl):
jl_app = load_jl_app(
(HERE.parent / "accordion" / "simple.jl"), "accordion"
(HERE.parent / "accordion" / "callback.jl"), "accordion"
)
with open("app.jl", "w") as f:
f.write(jl_app)
dashjl.start_server(jl_app)
check_simple_callbacks(dashjl)
check_callback_callbacks(dashjl)


def check_simple_callbacks(runner):
def check_callback_callbacks(runner):
# Find the accordion object
accordion_comp = runner.find_element("#accordion")
accordion_text = runner.find_element("#accordion-contents")
Expand Down
17 changes: 11 additions & 6 deletions docs/components_page/components/__tests__/test_carousel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ def test_jl_carousel(dashjl):

def check_carousel_callbacks(runner):

runner.find_element(
"label[for='_dbcprivate_radioitems_slide-number_input_1']"
).click()
item = "label[for='_dbcprivate_radioitems_slide-number_input_1']"

runner.find_element(item).click()

wait.until(
lambda: runner.find_elements("div.carousel-item")[1].get_attribute(
"class"
lambda: len(
{"carousel-item", "active"}
- set(
runner.find_elements("div.carousel-item")[1].get_attribute(
"class"
)
)
)
== "carousel-item active",
== 0,
timeout=4,
)
42 changes: 0 additions & 42 deletions docs/components_page/components/__tests__/test_collapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,45 +71,3 @@ def check_collapse_multiple_callbacks(runner):
== "collapse show",
timeout=4,
)


# --------------------------------------------
# accordion


def test_r_collapse_accordion(dashr):
r_app = load_r_app((HERE.parent / "collapse" / "accordion.R"), "accordion")
dashr.start_server(r_app)
check_collapse_accordion_callbacks(dashr)


def test_jl_collapse_accordion(dashjl):
jl_app = load_jl_app(
(HERE.parent / "collapse" / "accordion.jl"), "accordion"
)
dashjl.start_server(jl_app)
check_collapse_accordion_callbacks(dashjl)


def check_collapse_accordion_callbacks(runner):

runner.find_element("#group-1-toggle").click()
wait.until(
lambda: runner.find_element("#collapse-1").get_attribute("class")
== "collapse show",
timeout=4,
)

runner.find_element("#group-2-toggle").click()
wait.until(
lambda: runner.find_element("#collapse-2").get_attribute("class")
== "collapse show",
timeout=4,
)

runner.find_element("#group-3-toggle").click()
wait.until(
lambda: runner.find_element("#collapse-3").get_attribute("class")
== "collapse show",
timeout=4,
)
22 changes: 18 additions & 4 deletions docs/components_page/components/__tests__/test_navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@ def check_navbar_callbacks(runner):
runner.driver.set_window_size(375, 667)

wait.until(
lambda: runner.find_element("#navbar-collapse").get_attribute("class")
== "collapse navbar-collapse",
lambda: len(
{"navbar-collapse", "collapse"}
- set(
runner.find_element("#navbar-collapse")
.get_attribute("class")
.split()
)
)
== 0,
timeout=4,
)

runner.find_element("#navbar-toggler").click()
wait.until(
lambda: runner.find_element("#navbar-collapse").get_attribute("class")
== "collapse show navbar-collapse",
lambda: len(
{"navbar-collapse", "collapse", "show"}
- set(
runner.find_element("#navbar-collapse")
.get_attribute("class")
.split()
)
)
== 0,
timeout=4,
)
47 changes: 28 additions & 19 deletions docs/components_page/components/__tests__/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,38 @@
HERE = Path(__file__).parent


def test_r_pagination_simple(dashr):
r_app = load_r_app((HERE.parent / "pagination" / "simple.R"), "pagination")
def test_r_pagination_callback(dashr):
r_app = load_r_app(
(HERE.parent / "pagination" / "callback.R"), "pagination"
)
dashr.start_server(r_app)
check_pagination_simple_callbacks(dashr)
check_pagination_callback_callbacks(dashr)


def test_jl_pagination_simple(dashjl):
def test_jl_pagination_callback(dashjl):
jl_app = load_jl_app(
(HERE.parent / "pagination" / "simple.jl"), "pagination"
(HERE.parent / "pagination" / "callback.jl"), "pagination"
)
dashjl.start_server(jl_app)
check_pagination_simple_callbacks(dashjl)

check_pagination_callback_callbacks(dashjl)

def check_pagination_simple_callbacks(runner):

# Find the pagination object
pagination_comp = runner.find_element("#pagination")
pagination_text = runner.find_element("#pagination-contents")
def check_pagination_callback_callbacks(runner):

# Check it has 10 page-items objects in it
pages = pagination_comp.find_elements(".page-item")
pages = runner.find_elements("#pagination .page-item")
wait.until(
lambda: len(pages) == 10,
timeout=4,
)

# Ensure that all the items have loaded
wait.until(
lambda: runner.find_element("#pagination-contents").text
== "Page selected: 1",
timeout=4,
)

# Click the link with text 7
wait.until(
lambda: pages[6].text == "7",
Expand All @@ -46,22 +51,26 @@ def check_pagination_simple_callbacks(runner):

# Check the text in contents changes to "Page selected: 7"
wait.until(
lambda: pagination_text.text == "Page selected: 7",
lambda: runner.find_element("#pagination-contents").text
== "Page selected: 7",
timeout=4,
)

# Change the slider to value 5
runner.click_at_coord_fractions(
runner.find_element("#page-change"), 0.5, 0.25
)
page_changer = runner.find_element("#page-change")
runner.click_at_coord_fractions(page_changer, 0.5, 0.25)

# Check the text in contents changes to "Page selected: 5"
wait.until(
lambda: pagination_text.text == "Page selected: 5",
lambda: runner.find_element("#pagination-contents").text
== "Page selected: 5",
timeout=4,
)

# Check that the <li> object inside pagination with number = 5
# has active as a class
pages = pagination_comp.find_element(".active")
wait.until(lambda: pages[4].text == "5")
active_page = runner.find_element("#pagination .active")
wait.until(
lambda: active_page.text.split("\n") == ["5", "(current)"],
timeout=4,
)
1 change: 1 addition & 0 deletions docs/components_page/components/__tests__/test_popover.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_jl_popover(dashjl):


def check_popover_callbacks(runner):

assert len(runner.find_elements("#popover")) == 0
runner.find_element("#toggle").click()
wait.until(
Expand Down
12 changes: 8 additions & 4 deletions docs/components_page/components/__tests__/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
for path in HERE.parent.glob("*.md")
]

SKIP = ["components/table/kwargs.py", "components/tabs/active_tab.py"]
SKIP = [
"components/table/kwargs.py",
"components/table/color.py",
"components/tabs/active_tab.py",
]
ENVS = {
"modal.md": {
"LOREM": (HERE.parent / "modal" / "lorem.txt").read_text().strip()
Expand Down Expand Up @@ -135,9 +139,9 @@ def assert_layouts_equal(
snippet="\n".join(x[1] for x in compare),
components=", ".join(x[2] for x in compare),
port=port,
).replace(
"class_name", "className"
) # TODO: remove
)
.replace("class_name", "className")
.replace("_className", "_class_name") # TODO: remove
)
layout = requests.get(f"{runner.url}/_dash-layout").json()

Expand Down
Loading