From 514c8e5cd3adeed1427745a80ee6d368bda63692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 29 Jun 2017 11:30:09 +0200 Subject: [FIX] web: prevent dirty state after test The test changed in this commit had a big issue: it did not properly destroy the second form view that it created. Because of that, it was still alive and could interact with other tests, such as the barcode tests. This is what happened: 1. var form was assigned to a form view 2. form was destroyed 3. in a try catch, form was reassigned to the result of createView, but the evaluation of createView crashed (after creating a form view), so the assignation was not done, and the var form was still pointing to the first form view 4. form.destroy is called, which did nothing for the second form view. There is no easy way to get the reference to the form view created by createView without changing some other code, so we simply remove the second part of the test, which was not particularly important. --- addons/web/static/tests/fields/basic_fields_tests.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 50daedb7dcb..c732fe35ce6 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -2115,7 +2115,7 @@ QUnit.module('basic_fields', { }); QUnit.test('integer field in form view with virtual id', function (assert) { - assert.expect(2); + assert.expect(1); var params = { View: FormView, model: 'partner', @@ -2127,15 +2127,7 @@ QUnit.module('basic_fields', { var form = createView(params); assert.strictEqual(form.$('.o_field_widget').text(), "2-20170808020000", "Should display virtual id"); - form.destroy(); - params.res_id = this.data.partner.records[1].id = "2.65-20170808020000"; - try { - form = createView(params); - } catch (error) { - assert.strictEqual(error.message, '"2.65-20170808020000" is not an integer or a virtual id', - "Should throw an exception because it's a wrong value"); - } form.destroy(); }); -- cgit v1.2.3