summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/tests
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-12-07 14:06:29 +0100
committerGéry Debongnie <ged@odoo.com>2017-12-18 17:29:13 +0100
commitfa9f58d6ced2e18403506b1b59a8de2734d71671 (patch)
tree2584391bcf0b291c20f2fdcd2805a2319d07393e /addons/barcodes/static/tests
parent5e70e949d566269ae8df9ead7f8cc5aff790bbc0 (diff)
[IMP] web: tests: add a way to properly mock Widgets
This rev. introduces two helper functions for the tests: patch and unpatch. Those function allow patching an Odoo Widget (e.g. AbstractField), and unpatch it at the end of the test with the guarantee that the Widget's prototype is exactly the same as it was before the test. This was necessary because the way it was done before was a little bit too naive, and could lead to unexpected behavior. Indeed, doing var someFunction = AbstractField.prototype.someFunction; // test content AbstractField.prototype.someFunction = someFunction; is correct if someFunction is actually define (or overriden) in AbstractField, as in that case, it really exists on its prototype. Otherwise, it isn't correct if it is not directly defined on the prototype before the test, as it will be after..
Diffstat (limited to 'addons/barcodes/static/tests')
0 files changed, 0 insertions, 0 deletions