Пример #1
0
    def test_pass_url_fragments(self, app: Sphinx, _sb: BaseCase,
                                ensure_redirect):
        app.build()

        ensure_redirect("another/index.html", "index.html")
        _sb.open(rel2url(app.outdir, "another/index.html") + "#haha")
        # check url
        assert Path(rel2url(app.outdir, "index.html")) == Path(
            _sb.execute_script(
                'return  window.location.protocol + "//" + window.location.host + "/" + window.location.pathname'
            ))
        # check hash
        assert "#haha" == _sb.execute_script("return window.location.hash")
Пример #2
0
    def test_jinja(self, app: Sphinx, _sb: BaseCase):
        app.build()
        assert app.statuscode == 0

        _sb.open(rel2url(app.outdir, "another/index.html"))
        text = _sb.get_text(selector="html")
        text = text.replace("\\", "/")
        text = text.replace("//", "/")

        assert "rel_url: ../index.html" in text
        assert "from_file: another.rst" in text
        assert "to_file: index.rst" in text
        assert "from_url: another/index.html" in text
        assert "to_url: index.html" in text