Merge pull request #61 from akretion/8.0-web_context_tunnel-port

web_context_tunnel v8 port: asset bundle + tests
pull/69/head
Leonardo Pistone 2014-09-29 15:28:16 +02:00
commit b2d3f8ed9c
6 changed files with 24 additions and 8 deletions

View File

@ -68,7 +68,7 @@ Tests
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
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.
In fact you need to manually mimic the new web-client behavior by manually
@ -78,16 +78,17 @@ a !python statement like context.update({'my_extra_field': my_extra_field}).
You can see an example of module conversion to use web_context_tunnel here
for instance:
https://github.com/openerpbrasil/l10n_br_core/compare/develop...feature%2Fsale-web-context-tunnel
https://github.com/openerpbrasil/l10n_br_core/commit/33065366726a83dbc69b9f0031c81d82362fbfae
""",
'version': '2.0',
'depends': ['web'],
'js': ['static/src/js/context_tunnel.js'],
'data': [
'views/web_context_tunnel.xml',
],
'test': [
'static/test/context_tunnel.js',
],
'css': [],
'auto_install': False,
'installable': False,
'web_preload': False,
}

View File

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

View File

@ -1,7 +1,9 @@
openerp.testing.section('context_tunnel', {
dependencies: ['web.list', 'web.form'],
templates: true
}, function (test) {
test.dependencies = window['oe_all_dependencies'];
test("context composition", function (instance) {
new openerp.web_context_tunnel(instance);
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 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>