mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-10-25 23:40:05 -05:00
[PATCH] Upstream patch - 11102023
This commit is contained in:
1 parent
b6ef29352f
commit
4c71fc6016
11 files changed
+18
-17
No files matched your search
@@ -139,7 +139,7 @@ flectra.define('web.pager_tests', function (require) {
|
||||
});
|
||||
|
||||
QUnit.test('pager disabling', async function (assert) {
|
||||
assert.expect(9);
|
||||
assert.expect(10);
|
||||
|
||||
const reloadPromise = testUtils.makeTestPromise();
|
||||
const pager = await createComponent(Pager, {
|
||||
@@ -162,9 +162,9 @@ flectra.define('web.pager_tests', function (require) {
|
||||
});
|
||||
const pagerButtons = pager.el.querySelectorAll('button');
|
||||
|
||||
// Click twice
|
||||
await cpHelpers.pagerNext(pager);
|
||||
// Click and check button is disabled
|
||||
await cpHelpers.pagerNext(pager);
|
||||
assert.ok(pager.el.querySelector('button.o_pager_next').disabled);
|
||||
// Try to edit the pager value
|
||||
await testUtils.dom.click(pager.el.querySelector('.o_pager_value'));
|
||||
|
||||
|
||||
@@ -1979,8 +1979,7 @@ QUnit.module('fields', {}, function () {
|
||||
await testUtils.dom.click(form.$('.o_external_button'));
|
||||
await testUtils.dom.click($('button:contains("Just do it !")'));
|
||||
assert.verifySteps(['action']);
|
||||
await testUtils.dom.click($('button:contains("Just don\'t do it !")'));
|
||||
assert.verifySteps([]); // the second button is disabled, it can't be clicked
|
||||
assert.ok($('button:contains("Just don\'t do it !")').get(0).disabled);
|
||||
|
||||
await testUtils.dom.click($('.modal .btn-secondary:contains(Discard)'));
|
||||
await testUtils.dom.click(form.$('.o_external_button'));
|
||||
|
||||
@@ -5921,7 +5921,6 @@ QUnit.module('fields', {}, function () {
|
||||
// click all buttons
|
||||
await testUtils.dom.click(form.$(btn1Disabled));
|
||||
await testUtils.dom.click(form.$(btn1Warn));
|
||||
await testUtils.dom.click(form.$(btn2Disabled));
|
||||
await testUtils.dom.click(form.$(btn2Warn));
|
||||
|
||||
// save the form
|
||||
|
||||
@@ -116,6 +116,9 @@ flectra.define('web.test_utils_dom', function (require) {
|
||||
if (typeof el === 'string') {
|
||||
el = $(el);
|
||||
}
|
||||
if (el.disabled || (el instanceof jQuery && el.get(0).disabled)) {
|
||||
throw new Error("Can't click on a disabled button");
|
||||
}
|
||||
if (_isEventTarget(el)) {
|
||||
// EventTarget
|
||||
matches = [el];
|
||||
|
||||
@@ -7388,7 +7388,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('multiple clicks on save should reload only once', async function (assert) {
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
|
||||
var def = testUtils.makeTestPromise();
|
||||
|
||||
@@ -7420,7 +7420,7 @@ QUnit.module('Views', {
|
||||
await testUtils.form.clickEdit(form);
|
||||
await testUtils.fields.editInput(form.$('input[name="foo"]'), "test");
|
||||
await testUtils.form.clickSave(form);
|
||||
await testUtils.form.clickSave(form);
|
||||
assert.ok(form.$buttons.find('.o_form_button_save').get(0).disabled);
|
||||
|
||||
def.resolve();
|
||||
await testUtils.nextTick();
|
||||
|
||||
@@ -7310,7 +7310,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('multiple clicks on Add do not create invalid rows', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
|
||||
this.data.foo.onchanges = {
|
||||
m2o: function () {},
|
||||
@@ -7336,9 +7336,9 @@ QUnit.module('Views', {
|
||||
assert.containsN(list, '.o_data_row', 4,
|
||||
"should contain 4 records");
|
||||
|
||||
// click on Add twice, and delay the onchange
|
||||
testUtils.dom.click(list.$buttons.find('.o_list_button_add'));
|
||||
// click on Add and delay the onchange (check that the button is correctly disabled)
|
||||
testUtils.dom.click(list.$buttons.find('.o_list_button_add'));
|
||||
assert.ok(list.$buttons.find('.o_list_button_add').get(0).disabled);
|
||||
|
||||
prom.resolve();
|
||||
await testUtils.nextTick();
|
||||
|
||||
Reference in new issue
Block a user