summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/tests/barcode_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-08-25 18:44:09 +0200
committerAaron Bohy <aab@odoo.com>2017-08-25 18:55:50 +0200
commitdc07fc8baca782734215e25ef9ea6674cfb845bf (patch)
treedd87b7ebf8e71e153ba198070680e0f8a9017834 /addons/barcodes/static/tests/barcode_tests.js
parent0c1c93002c9bba02ae6a95d0af3b4706d0870a17 (diff)
[FIX] barcodes: tests: don't add undefined widget to registry
Resetting the key 'test_barcode_handler' to its value before the test was technically the best solution, as a test should leave the environment unchanged. However, in this case, the widget is undefined (there is obviously no 'test_barcode_handler'). Whereas this should not be a problem (the fields in the registry are supposed to be accessed using get(), and the presence of a key mapping undefined is equivalent to the absence of the key in this case), this breaks a test in Studio if the latter one is executed after the barcode test. This is because Studio browses the map of the field registry to access each field's prototype. When it encounters an undefined value, it crashes.
Diffstat (limited to 'addons/barcodes/static/tests/barcode_tests.js')
-rw-r--r--addons/barcodes/static/tests/barcode_tests.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/barcodes/static/tests/barcode_tests.js b/addons/barcodes/static/tests/barcode_tests.js
index add55ed4d5d..7487972ea62 100644
--- a/addons/barcodes/static/tests/barcode_tests.js
+++ b/addons/barcodes/static/tests/barcode_tests.js
@@ -348,7 +348,6 @@ QUnit.test('specification of widget barcode_handler', function (assert) {
});
},
});
- var previousField = fieldRegistry.get('test_barcode_handler');
fieldRegistry.add('test_barcode_handler', TestBarcodeHandler);
var form = createView({
@@ -402,6 +401,6 @@ QUnit.test('specification of widget barcode_handler', function (assert) {
form.destroy();
barcodeEvents.BarcodeEvents.max_time_between_keys_in_ms = delay;
- fieldRegistry.add('test_barcode_handler', previousField);
+ delete fieldRegistry.map.test_barcode_handler;
});
});