web_context_tunnel v8 port: asset bundle + tests

pull/61/head
Raphaël Valyi 2014-09-19 08:20:46 -03:00
parent c138bbb9e3
commit 58b58af75b
6 changed files with 23 additions and 7 deletions

View File

@ -68,7 +68,7 @@ Tests
This module comes with a simple test in static/test/context_tunnel.js. This module comes with a simple test in static/test/context_tunnel.js.
To run it, open the page /web/tests?mod=web_context_tunnel in your browser To run it, open the page /web/tests?mod=web_context_tunnel in your browser
as explained here https://doc.openerp.com/trunk/web/testing as explained here https://doc.openerp.com/trunk/web/testing
It should also by picked by the Python testing when testing with PhantomJS. It should also be picked by the Python testing when testing with PhantomJS.
As for testing modules using web_context_tunnel with YAML, yes it's possible. As for testing modules using web_context_tunnel with YAML, yes it's possible.
In fact you need to manually mimic the new web-client behavior by manually In fact you need to manually mimic the new web-client behavior by manually
@ -82,12 +82,13 @@ https://github.com/openerpbrasil/l10n_br_core/compare/develop...feature%2Fsale-w
""", """,
'version': '2.0', 'version': '2.0',
'depends': ['web'], 'depends': ['web'],
'js': ['static/src/js/context_tunnel.js'], 'data': [
'views/web_context_tunnel.xml',
],
'test': [ 'test': [
'static/test/context_tunnel.js', 'static/test/context_tunnel.js',
], ],
'css': [], 'css': [],
'auto_install': False, 'auto_install': False,
'installable': False,
'web_preload': False, 'web_preload': False,
} }

View File

@ -22,6 +22,3 @@ openerp.web_context_tunnel = function(instance) {
return v_context; return v_context;
}; };
}; };
// vim:et fdc=0 fdl=0:

View File

@ -1,7 +1,9 @@
openerp.testing.section('context_tunnel', { openerp.testing.section('context_tunnel', {
dependencies: ['web.list', 'web.form'],
templates: true
}, function (test) { }, function (test) {
test.dependencies = window['oe_all_dependencies'];
test("context composition", function (instance) { test("context composition", function (instance) {
new openerp.web_context_tunnel(instance);
var field_manager = new instance.web.form.DefaultFieldManager(); var field_manager = new instance.web.form.DefaultFieldManager();
var node = {'attrs': {'context': {'key1': 'value1', 'key2': 'value2'}, 'context_2': {'key3': 'value3'}, 'context_3': {'key4': 'value4'}}} var node = {'attrs': {'context': {'key1': 'value1', 'key2': 'value2'}, 'context_2': {'key3': 'value3'}, 'context_3': {'key4': 'value4'}}}
var w = new instance.web.form.FormWidget(field_manager, node); var w = new instance.web.form.FormWidget(field_manager, node);

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_context_tunnel assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_context_tunnel/static/src/js/context_tunnel.js"></script>
</xpath>
</template>
<template id="qunit_suite" name="web_context_tunnel qunit" inherit_id="web.qunit_suite">
<xpath expr="//head" position="inside">
<script type="text/javascript" src="/web_context_tunnel/static/test/context_tunnel.js"></script>
</xpath>
</template>
</data>
</openerp>