diff options
| author | Xavier Morel <xmo@openerp.com> | 2013-02-18 16:06:04 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2013-02-18 16:06:04 +0100 |
| commit | 1c2b769a1fc3e978ded0211af8a119b4a24c35f3 (patch) | |
| tree | dd76f5d577f7b1878c4b30d688764674035adf92 /addons/web/doc/module | |
| parent | 5e19bfd47b0bb8adca75133541540a0ee64a18af (diff) | |
[IMP] final section of the module guide
bzr revid: xmo@openerp.com-20130218150604-pjd9lkmc834tmbiz
Diffstat (limited to 'addons/web/doc/module')
| -rw-r--r-- | addons/web/doc/module/26 | 14 | ||||
| -rw-r--r-- | addons/web/doc/module/27 | 28 | ||||
| -rw-r--r-- | addons/web/doc/module/28 | 13 | ||||
| -rw-r--r-- | addons/web/doc/module/29 | 37 | ||||
| -rw-r--r-- | addons/web/doc/module/series | 3 | ||||
| -rw-r--r-- | addons/web/doc/module/testing_1.png | bin | 0 -> 36183 bytes |
6 files changed, 92 insertions, 3 deletions
diff --git a/addons/web/doc/module/26 b/addons/web/doc/module/26 index 4085350db24..ec0b345a908 100644 --- a/addons/web/doc/module/26 +++ b/addons/web/doc/module/26 @@ -2,7 +2,7 @@ Index: web_example/static/src/tests/timer.js =================================================================== --- web_example.orig/static/src/tests/timer.js +++ web_example/static/src/tests/timer.js -@@ -42,4 +42,25 @@ openerp.testing.section('timer', functio +@@ -42,4 +42,33 @@ openerp.testing.section('timer', functio w.format_time(84092336), '23:21:32'); }); @@ -18,13 +18,21 @@ Index: web_example/static/src/tests/timer.js + w.update_counter(22733958); + // And check the DOM matches + strictEqual($fixture.text(), '06:18:53'); -+ ++ + w.update_counter(73451828) + strictEqual($fixture.text(), '20:24:11'); + }); + test('display_record', function (instance, $fixture) { + var w = new instance.web_example.Action(); + $fixture.append('<ol class="oe_web_example_saved">') -+ ok(false, "test display records"); ++ w.setElement($fixture); ++ ++ w.display_record({time: 41676639}); ++ w.display_record({time: 84092336}); ++ ++ var $lis = $fixture.find('li'); ++ strictEqual($lis.length, 2, "should have printed 2 records"); ++ strictEqual($lis[0].textContent, '11:34:36'); ++ strictEqual($lis[1].textContent, '23:21:32'); + }); }); diff --git a/addons/web/doc/module/27 b/addons/web/doc/module/27 new file mode 100644 index 00000000000..2061b7007e6 --- /dev/null +++ b/addons/web/doc/module/27 @@ -0,0 +1,28 @@ +Index: web_example/static/src/tests/timer.js +=================================================================== +--- web_example.orig/static/src/tests/timer.js ++++ web_example/static/src/tests/timer.js +@@ -71,4 +71,23 @@ openerp.testing.section('timer', functio + strictEqual($lis[0].textContent, '11:34:36'); + strictEqual($lis[1].textContent, '23:21:32'); + }); ++ test('start', {templates: true, rpc: 'mock', asserts: 3}, function (instance, $fixture, mock) { ++ // Rather odd-looking shortcut for search+read in a single RPC call ++ mock('/web/dataset/search_read', function () { ++ // ignore parameters, just return a pair of records. ++ return {records: [ ++ {time: 22733958}, ++ {time: 84092336} ++ ]}; ++ }); ++ ++ var w = new instance.web_example.Action(); ++ return w.appendTo($fixture) ++ .then(function () { ++ var $lis = $fixture.find('li'); ++ strictEqual($lis.length, 2); ++ strictEqual($lis[0].textContent, '06:18:53'); ++ strictEqual($lis[1].textContent, '23:21:32'); ++ }); ++ }); + }); diff --git a/addons/web/doc/module/28 b/addons/web/doc/module/28 new file mode 100644 index 00000000000..800e7a6f084 --- /dev/null +++ b/addons/web/doc/module/28 @@ -0,0 +1,13 @@ +Index: web_example/static/src/js/first_module.js +=================================================================== +--- web_example.orig/static/src/js/first_module.js ++++ web_example/static/src/js/first_module.js +@@ -66,7 +66,7 @@ openerp.web_example = function (instance + user_id: instance.session.uid, + time: time, + }; +- this.model.call('create', [record]).done(function () { ++ return this.model.call('create', [record]).done(function () { + self.display_record(record); + }); + }, diff --git a/addons/web/doc/module/29 b/addons/web/doc/module/29 new file mode 100644 index 00000000000..509d4b78662 --- /dev/null +++ b/addons/web/doc/module/29 @@ -0,0 +1,37 @@ +Index: web_example/static/src/tests/timer.js +=================================================================== +--- web_example.orig/static/src/tests/timer.js ++++ web_example/static/src/tests/timer.js +@@ -90,4 +90,32 @@ openerp.testing.section('timer', functio + strictEqual($lis[1].textContent, '23:21:32'); + }); + }); ++ test('watch_stop', {templates: true, rpc: 'mock', asserts: 3}, function (instance, $fix, mock) { ++ var created = false; ++ mock('web_example.stopwatch:create', function (args, kwargs) { ++ created = true; ++ // return a fake id (unused) ++ return 42; ++ }); ++ mock('/web/dataset/search_read', function () { ++ return {records: []}; ++ }); ++ ++ var w = new instance.web_example.Action(); ++ return w.appendTo($fix) ++ .then(function () { ++ // Virtual start point 5s before 'now' ++ w._start = new Date() - 5000; ++ return w.watch_stop(); ++ }) ++ .done(function () { ++ ok(created, "should have called create()"); ++ strictEqual($fix.find('.oe_web_example_timer').text(), ++ '00:00:05', ++ "should have updated the timer"); ++ strictEqual($fix.find('li')[0].textContent, ++ '00:00:05', ++ "should have added the new time to the list"); ++ }); ++ }); + }); diff --git a/addons/web/doc/module/series b/addons/web/doc/module/series index 491e7dc3c59..ff1a909a6af 100644 --- a/addons/web/doc/module/series +++ b/addons/web/doc/module/series @@ -22,3 +22,6 @@ 24 25 26 +27 +28 +29 diff --git a/addons/web/doc/module/testing_1.png b/addons/web/doc/module/testing_1.png Binary files differnew file mode 100644 index 00000000000..40cf32497eb --- /dev/null +++ b/addons/web/doc/module/testing_1.png |
