8000 make append as False in display by madhur-tandon · Pull Request #1807 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

make append as False in display #1807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyscript.core/src/stdlib/pyscript/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _write(element, value, append=False):
out_element.innerHTML = html


def display(*values, target=None, append=True):
def display(*values, target=None, append=False):
if target is None:
target = current_target()
elif not isinstance(target, str):
Expand Down
26 changes: 13 additions & 13 deletions pyscript.core/tests/integration/test_02_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_simple_display(self):
<script type="py">
print('ciao')
from pyscript import display
display("hello world")
display("hello world", append=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, if we want to be sure about any default, we can keep one of these without the append field ... what do you think?

</script>
""",
timeout=20000,
Expand Down Expand Up @@ -140,9 +140,9 @@ def test_tag_target_attribute(self):
"""
<script type="py" target="hello">
from pyscript import display
display('hello')
display("goodbye world", target="goodbye")
display('world')
display('hello', append=True)
display("goodbye world", target="goodbye", append=True)
display('world', append=True)
</script>
<div id="hello"></div>
<div id="goodbye"></div>
Expand Down Expand Up @@ -179,16 +179,16 @@ def test_consecutive_display_target(self):
"""
<script type="py" id="first">
from pyscript import display
display('hello 1')
display('hello 1', append=True)
</script>
<p>hello in between 1 and 2</p>
<script type="py" id="second">
from pyscript import display
display('hello 2', target="second")
display('hello 2', target="second", append=True)
</script>
<script type="py" id="third">
from pyscript import display
display('hello 3')
display('hello 3', append=True)
</script>
"""
)
Expand All @@ -202,8 +202,8 @@ def test_multiple_display_calls_same_tag(self):
"""
<script type="py">
from pyscript import display
display('hello')
display('world')
display('hello', append=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here ... if we really want to be sure append=True is the default, we should keep this not touched to me

display('world', append=True)
</script>
"""
)
Expand Down Expand Up @@ -316,7 +316,7 @@ def test_display_multiple_values(self):
from pyscript import display
hello = 'hello'
world = 'world'
display(hello, world)
display(hello, world, append=True)
</script>
"""
)
Expand Down Expand Up @@ -377,7 +377,7 @@ def test_display_list_dict_tuple(self):
l = ['A', 1, '!']
d = {'B': 2, 'List': l}
t = ('C', 3, '!')
display(l, d, t)
display(l, d, t, append=True)
</script>
"""
)
Expand All @@ -394,7 +394,7 @@ def test_display_should_escape(self):
"""
<script type="py">
from pyscript import display
display("<p>hello world</p>")
display("<p>hello world</p>", append=True)
</script>
"""
)
Expand All @@ -407,7 +407,7 @@ def test_display_HTML(self):
"""
<script type="py">
from pyscript import display, HTML
display(HTML("<p>hello world</p>"))
display(HTML("<p>hello world</p>"), append=True)
</script>
"""
)
Expand Down
0