mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 22:00:25 -05:00
Fix test and add new ones to close 878 (#971)
* Fix test and add new ones to close 887 * lint
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import html
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from .support import PyScriptTest
|
||||
|
||||
|
||||
@@ -19,7 +17,6 @@ class TestOutput(PyScriptTest):
|
||||
pattern = r'<div id="py-.*">hello world</div>'
|
||||
assert re.search(pattern, inner_html)
|
||||
|
||||
@pytest.mark.xfail(reason="issue #878")
|
||||
def test_consecutive_display(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
@@ -37,12 +34,11 @@ class TestOutput(PyScriptTest):
|
||||
lines = [line for line in lines if line != ""] # remove empty lines
|
||||
assert lines == ["hello 1", "hello 2", "hello 3"]
|
||||
|
||||
@pytest.mark.xfail(reason="fix me")
|
||||
def test_output_attribute(self):
|
||||
def test_target_attribute(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-script output="mydiv">
|
||||
display('hello world')
|
||||
<py-script>
|
||||
display('hello world', target="mydiv")
|
||||
</py-script>
|
||||
<div id="mydiv"></div>
|
||||
"""
|
||||
@@ -50,6 +46,26 @@ class TestOutput(PyScriptTest):
|
||||
mydiv = self.page.locator("#mydiv")
|
||||
assert mydiv.inner_text() == "hello world"
|
||||
|
||||
def test_consecutive_display_target(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-script id="first">
|
||||
display('hello 1')
|
||||
</py-script>
|
||||
<p>hello in between 1 and 2</p>
|
||||
<py-script id="second">
|
||||
display('hello 2', target="second")
|
||||
</py-script>
|
||||
<py-script id="third">
|
||||
display('hello 3')
|
||||
</py-script>
|
||||
"""
|
||||
)
|
||||
inner_text = self.page.inner_text("body")
|
||||
lines = inner_text.splitlines()
|
||||
lines = [line for line in lines if line != ""] # remove empty lines
|
||||
assert lines == ["hello 1", "hello in between 1 and 2", "hello 2", "hello 3"]
|
||||
|
||||
def test_multiple_display_calls_same_tag(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user