[ADD] theme saas-14.3

This commit is contained in:
Jeremy Kersten
2021-05-10 15:46:42 +02:00
parent 2bdf71a2b2
commit 84ba083d17
208 changed files with 3170 additions and 4050 deletions
+5 -1
View File
@@ -40,10 +40,14 @@
'theme_zap',
],
'data': [
'views/assets.xml',
'views/website_navbar_templates.xml',
],
'installable': True,
'application': False,
'post_init_hook': 'post_init_hook',
'assets': {
'web.assets_frontend': [
'test_themes/static/src/js/navbar.js',
],
}
}
+13 -2
View File
@@ -13,12 +13,23 @@ class Crawler(HttpCase):
Website = self.env['website']
websites_themes = Website.get_test_themes_websites()
assert len(websites_themes) == len(self.env.ref('base.module_test_themes').dependencies_id)
websites_themes_names = websites_themes.mapped('name')
def test_crawling():
for website in websites_themes.filtered(lambda w: w.theme_id.name != 'theme_default'):
# Ensure theme is rendering without crashing
r = self.url_open('/?fw=%s&debug=assets' % website.id)
self.assertEqual(r.status_code, 200, "Ensure rendering went fine as public user")
self.assertTrue('/%s/static/src' % website.theme_id.name in r.text, "Ensure rendering went fine as public user")
self.assertEqual(r.status_code, 200, "Ensure theme is rendering without crashing")
# Ensure correct theme is actually loaded, see commit message
theme_asset_url = '/web/assets/debug/%s/web.assets_frontend.css' % website.id
self.assertTrue(theme_asset_url in r.text)
r = self.url_open(theme_asset_url)
self.assertTrue('/%s/static/src' % website.theme_id.name in r.text, "Ensure theme is actually loaded")
# Ensure other website/themes are not loaded
for name in websites_themes_names:
if name != website.theme_id.name:
self.assertFalse('/%s/static/src' % name in r.text, "Ensure other themes do not pollute current one")
# 1. Test as public user
test_crawling()
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Website Assets">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/test_themes/static/src/js/navbar.js"/>
</xpath>
</template>
</odoo>