[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]:
```
<main class="modal-body">
<div>
<p>
...
</p>
</div>
</main>
```
Partial HTML after [1]:
```
<main class="modal-body">
<main role="alert" class="modal-body">
<p>
...
</p>
</main>
</main>
```
In order to not pick both DOM elements, we refine the jQuery selector to pick
the `<p>`, 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
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user