summaryrefslogtreecommitdiff
path: root/addons/web/doc/module/29
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/web/doc/module/29
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/web/doc/module/29')
-rw-r--r--addons/web/doc/module/2937
1 files changed, 37 insertions, 0 deletions
diff --git a/addons/web/doc/module/29 b/addons/web/doc/module/29
new file mode 100644
index 00000000..509d4b78
--- /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");
++ });
++ });
+ });