Skip to content

Commit

Permalink
adds comments and makes used template identifyable
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Aug 24, 2022
1 parent 1185942 commit 5b406d7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
7 changes: 6 additions & 1 deletion justpy/quasarcomponents.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@


class QuasarPage(WebPage):
'''
a Quasar based WebPage
'''

def __init__(self, **kwargs):
'''
constructor
'''
super().__init__(**kwargs)
self.tailwind = kwargs.get('tailwind', False)
self.template_file = 'quasar.html'
self.quasar = True


async def set_dark_mode(self, flag):
try:
websocket_dict = WebPage.sockets[self.page_id]
Expand Down
14 changes: 7 additions & 7 deletions justpy/templates/tailwind.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% if not html %}

<!DOCTYPE html>
<html>
<head>
<!DOCTYPE html>
<html>
<!--This is a justpy application using the tailwind.html template-->
<head>
{% include 'favicon.html' %}

{% if options.tailwind %}
Expand Down Expand Up @@ -60,9 +60,9 @@

{% include 'main.html' %}

</body>
</html>
{% else %}{{ html | safe }}
</body>
</html>
{% else %}{{ html | safe }}
{% endif %}


14 changes: 13 additions & 1 deletion tests/test_justpy_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class TestJustpyCore(asynctest.TestCase):
Tests for Justpy Core features
'''
async def wp_to_test(self):
'''
the example Webpage under test
'''
wp = jp.WebPage()
_d=jp.Div(a=wp)
return wp
Expand All @@ -32,18 +35,27 @@ async def setUp(self):
},
daemon=True)
self.proc.start()
await asyncio.sleep(0.1) # time for the server to start
await asyncio.sleep(0.5) # time for the server to start

async def tearDown(self):
""" Shutdown the app. """
self.proc.terminate()


async def testWp(self):
''''
test the webpage asynchronously
'''
async with aiohttp.ClientSession() as session:
async with session.get(f"http://127.0.0.1:{self.port}/") as resp:
rawhtml = await resp.content.read()
status = resp.status
self.assertEqual(200,status)
html=rawhtml.decode("utf8")
debug=True
if debug:
print(html)




0 comments on commit 5b406d7

Please sign in to comment.