Browse Source

web_context_tunnel v8 port: asset bundle + tests

pull/61/head
Raphaël Valyi 10 years ago
parent
commit
58b58af75b
  1. 0
      web_context_tunnel/__init__.py
  2. 7
      web_context_tunnel/__openerp__.py
  3. 0
      web_context_tunnel/i18n/web_context_tunnel.pot
  4. 3
      web_context_tunnel/static/src/js/context_tunnel.js
  5. 4
      web_context_tunnel/static/test/context_tunnel.js
  6. 16
      web_context_tunnel/views/web_context_tunnel.xml

0
__unported__/web_context_tunnel/__init__.py → web_context_tunnel/__init__.py

7
__unported__/web_context_tunnel/__openerp__.py → web_context_tunnel/__openerp__.py

@ -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,
} }

0
__unported__/web_context_tunnel/i18n/web_context_tunnel.pot → web_context_tunnel/i18n/web_context_tunnel.pot

3
__unported__/web_context_tunnel/static/src/js/context_tunnel.js → web_context_tunnel/static/src/js/context_tunnel.js

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

4
__unported__/web_context_tunnel/static/test/context_tunnel.js → web_context_tunnel/static/test/context_tunnel.js

@ -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);

16
web_context_tunnel/views/web_context_tunnel.xml

@ -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>
Loading…
Cancel
Save