[FIX] web: fix missing tests for discard buttons update
Previously, the buttons were not updated properly after discarding
from an editable list view. The user was stuck with "Discard" even
though there was nothing to discard anymore, and he could not create
a new record either since the "Create" button was invisible.
This was fixed by 3aad756. I originally did a different fix which
has since been rendered useless, but the tests I wrote are still
meaningful since they are testing a different case than the commit
which fixed the issue.
This commit is contained in:
@@ -1432,7 +1432,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('edition: create new line, then discard', function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(8);
|
||||
|
||||
var list = createView({
|
||||
View: ListView,
|
||||
@@ -1443,10 +1443,22 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(list.$('tr.o_data_row').length, 4,
|
||||
"should have 4 records");
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_add:visible').length, 1,
|
||||
"create button should be visible");
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_discard:visible').length, 0,
|
||||
"discard button should be hidden");
|
||||
list.$buttons.find('.o_list_button_add').click();
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_add:visible').length, 0,
|
||||
"create button should be hidden");
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_discard:visible').length, 1,
|
||||
"discard button should be visible");
|
||||
list.$buttons.find('.o_list_button_discard').click();
|
||||
assert.strictEqual(list.$('tr.o_data_row').length, 4,
|
||||
"should still have 4 records");
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_add:visible').length, 1,
|
||||
"create button should be visible again");
|
||||
assert.strictEqual(list.$buttons.find('.o_list_button_discard:visible').length, 0,
|
||||
"discard button should be hidden again");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user