-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-implement the `show_scrolltop` functionality. I _think_ I wanted to remove the scroll to top button with version 5, but I left in the template and configuration option. Since it was documented behavior, I treated this as a bug and re-implemented the behavior with Alpine. Fixes #1981.
- Loading branch information
Showing
6 changed files
with
55 additions
and
7 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "sphinxawesome-theme" | ||
version = "5.3.0" | ||
version = "5.3.1" | ||
description = "An awesome theme for the Sphinx documentation generator" | ||
readme = "README.md" | ||
authors = ["Kai Welke <[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 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Test the presence or absense of the scroll to top button.""" | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
from sphinx.application import Sphinx | ||
|
||
from .util import parse_html | ||
|
||
|
||
@pytest.mark.sphinx( | ||
"html", | ||
confoverrides={ | ||
"html_theme": "sphinxawesome_theme", | ||
}, | ||
) | ||
def test_no_scroll_top_button(app: Sphinx) -> None: | ||
"""It doesn't have a scroll to top button by default.""" | ||
app.build() | ||
assert os.path.exists(Path(app.outdir) / "index.html") | ||
tree = parse_html(Path(app.outdir) / "index.html") | ||
button = tree.select("button#scrolltop") | ||
assert len(button) == 0 | ||
|
||
|
||
@pytest.mark.sphinx( | ||
"html", | ||
confoverrides={ | ||
"html_theme": "sphinxawesome_theme", | ||
"html_theme_options": {"show_scrolltop": True}, | ||
}, | ||
) | ||
def test_scroll_top_button(app: Sphinx) -> None: | ||
"""It shows a scroll to top button.""" | ||
app.build() | ||
assert os.path.exists(Path(app.outdir) / "index.html") | ||
tree = parse_html(Path(app.outdir) / "index.html") | ||
button = tree.select("button#scrolltop") | ||
assert len(button) == 1 |