[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.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user