From 46f1609b4a8c361d30941850436951b4f02e985a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Fri, 29 Jun 2018 14:14:00 +0200 Subject: [PATCH] [FIX] mail:tests: more precise jQuery selector on modal body content Tests from [1] were not passing, due to changes from [2]. This is due to the fact that `$.('.modal-body')` picks 2 elements, instead of 1. Partial HTML before [2]: ```

...

``` Partial HTML after [1]: ```

...

``` In order to not pick both DOM elements, we refine the jQuery selector to pick the `

`, so that there's only one element and it has the same text content. [1] [FIX] mail: warn user on record reload before post message https://github.com/odoo/odoo/commit/b74d1e90ef32893bfbcf750cdf4586c453790b01 [2] [IMP] Improve compatibility with screen readers (accessibility) (#24574) https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548 --- addons/mail/static/tests/chatter_tests.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 913e6a66d81..ea3c12affc5 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -654,7 +654,7 @@ QUnit.test('chatter: discard changes on message post with post_refresh "always"' var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body').text(), + assert.strictEqual($modal.find('.modal-body p').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost"); @@ -830,7 +830,7 @@ QUnit.test('chatter: discard changes on message post with post_refresh "recipien var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body').text(), + assert.strictEqual($modal.find('.modal-body p').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost"); @@ -883,7 +883,7 @@ QUnit.test('chatter: discard changes on opening full-composer', function (assert var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body').text(), + assert.strictEqual($modal.find('.modal-body p').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost");