Odoo?е?Javascript???????
???????????? ???????[ 2015/11/12 11:05:45 ] ????????Javascript ???????
??????????????QUnit???е???????????ο?????????https://www.odoo.com/documentation/8.0/reference/javascript.html
????????/web/tests???????????????а??????????????????б??
????????嵥???????????£?
????1. __openerp__?????????js??????????
??????????????н?js???д??'test'?У?????????view???????view?????????js???????8.0?????Ч)
????<template id="assets_backend" name="qweb_test" inherit_id="web.qunit_suite">
????<xpath expr="//head" position="inside">
????<script type="text/javascript" src="/px_qweb/static/test/demo.js"></script>
????</xpath>
????</template>
????2. ????js?????д???????
?????????????openerp.testing????????????д??section?????С?
????openerp.testing.section('my.test'??function(test){
????test('my first test'??function(){
????ok(false??"this test has run");
????});
????});
????3.????
????ok(state[??messsage]):???state??????
????strictEqual(actual??expected[??message]):?????????
????notStrictEqual(actual??expected[??message]):???????????
????deepEqual(actual??expected[??message]):????????????????????????????????????
????notDeepEqual(actual??expected[??message]):??deepEqual??
????throws(block[??expected][??messsage]):block???????????????????????(expected)????
????equal(actual??expected[??message]):??????????
????notEqual(actual??expected[??message]):??equal??
?????????
?????????data.js?????
????(function(){
????openerp.px_qweb = {
????value_true:true??
????SomeType: openerp.web.Class.extend({
????init:function(value){
????this.value = value;
????}
????})
????};
????}());
????????????
????openerp.testing.section('PX QWeb'??function(test){
????test('PX Test'??function(instance){
????ok(instance.px_qweb.value_true??'should have a true value');
????var type_instance = new instance.px_qweb.SomeType(50);
????strictEqual(type_instance.value??50??'should have provided value.');
????});
????});
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11