From 4e8281c749f89bb7fcb6088630f30ebf7e5f3f32 Mon Sep 17 00:00:00 2001
From: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com>
Date: Tue, 24 Jan 2023 22:01:19 +0530
Subject: [PATCH] fix display multiple append with target (#1126)
* fix display multiple append with target
* flake8 ignore long lines
* fix img render test
---
pyscriptjs/src/python/pyscript.py | 2 +-
.../tests/integration/test_02_display.py | 30 ++++++++++++++++---
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/pyscriptjs/src/python/pyscript.py b/pyscriptjs/src/python/pyscript.py
index a9fcfda3..eb1fd890 100644
--- a/pyscriptjs/src/python/pyscript.py
+++ b/pyscriptjs/src/python/pyscript.py
@@ -250,7 +250,7 @@ class Element:
child = js.document.createElement("div")
self.element.appendChild(child)
- if self.element.children:
+ if append and self.element.children:
out_element = self.element.children[-1]
else:
out_element = self.element
diff --git a/pyscriptjs/tests/integration/test_02_display.py b/pyscriptjs/tests/integration/test_02_display.py
index ad7fbecb..05825a6d 100644
--- a/pyscriptjs/tests/integration/test_02_display.py
+++ b/pyscriptjs/tests/integration/test_02_display.py
@@ -219,6 +219,31 @@ class TestOutput(PyScriptTest):
pattern = r'