def _bundle(self, should_create, should_unlink): self.counter.clear() files, remains = self.env['ir.qweb']._get_asset_content(self.lessbundle_xmlid, {}) asset = AssetsBundle(self.lessbundle_xmlid, files, remains, env=self.env) asset.to_html(debug='assets') self.assertEquals(self.counter['create'], int(should_create)) self.assertEquals(self.counter['unlink'], int(should_unlink))
def theme_customize(self, enable, disable, get_bundle=False): """ enable or Disable lists of ``xml_id`` of the inherit templates """ cr, uid, context, pool = request.cr, request.uid, request.context, request.registry view = pool["ir.ui.view"] context = dict(request.context or {}, active_test=True) def set_active(ids, active): if ids: view.write(cr, uid, self.get_view_ids(ids), {'active': active}, context=context) set_active(disable, False) set_active(enable, True) if get_bundle: bundle = AssetsBundle('website.assets_frontend', cr=http.request.cr, uid=http.request.uid, context={}, registry=http.request.registry) return bundle.to_html() return True
def test_12_paginated_css_debug(self): """ Check that a bundle in debug mode outputs non-minified assets. """ debug_bundle = AssetsBundle(self.cssbundle_xmlid, cr=self.cr, uid=self.uid, context={}, registry=self.registry, max_css_rules=1) content = debug_bundle.to_html(debug=True) # find back one of the original asset file self.assertIn('/test_assetsbundle/static/src/css/test_cssfile1.css', content) # there shouldn't be any assets created in debug mode self.assertEquals(len(self._any_ira_for_bundle('css')), 0)
def test_05_debug(self): """ Checks that a bundle rendered in debug mode outputs non-minified assets. """ debug_bundle = AssetsBundle(self.jsbundle_xmlid, cr=self.cr, uid=self.uid, context={}, registry=self.registry) content = debug_bundle.to_html(debug=True) # find back one of the original asset file self.assertIn('/test_assetsbundle/static/src/js/test_jsfile1.js', content) # there shouldn't be any assets created in debug mode self.assertEquals(len(self._any_ira_for_bundle('js')), 0)
def test_05_debug(self): """ Checks that a bundle rendered in debug mode outputs non-minified assets. """ debug_bundle = AssetsBundle(self.jsbundle_xmlid, env=self.env) content = debug_bundle.to_html(debug='assets') # find back one of the original asset file self.assertIn('/test_assetsbundle/static/src/js/test_jsfile1.js', content) # there shouldn't be any assets created in debug mode self.assertEquals(len(self._any_ira_for_bundle('js')), 0)
def test_12_paginated_css_debug(self): """ Check that a bundle in debug mode outputs non-minified assets. """ debug_bundle = AssetsBundle(self.cssbundle_xmlid, env=self.env, max_css_rules=1) content = debug_bundle.to_html(debug='assets') # find back one of the original asset file self.assertIn('/test_assetsbundle/static/src/css/test_cssfile1.css', content) # there shouldn't be any assets created in debug mode self.assertEquals(len(self._any_ira_for_bundle('css')), 0)
def theme_customize(self, enable, disable, get_bundle=False): """ enable or Disable lists of ``xml_id`` of the inherit templates """ cr, uid, context, pool = request.cr, request.uid, request.context, request.registry view = pool["ir.ui.view"] context = dict(request.context or {}, active_test=True) def set_active(ids, active): if ids: view.write(cr, uid, self.get_view_ids(ids), {'active': active}, context=context) set_active(disable, False) set_active(enable, True) if get_bundle: bundle = AssetsBundle('website.assets_frontend', cr=http.request.cr, uid=http.request.uid, context={}, registry=http.request.registry) return bundle.to_html() return True