diff options
| author | Luis González <lgonzalez@vauxoo.com> | 2018-03-22 07:18:35 -0400 |
|---|---|---|
| committer | kujiu <kujiu@users.noreply.github.com> | 2018-03-22 12:18:35 +0100 |
| commit | ef540eb006abac0d318f2a708384d125f6203662 (patch) | |
| tree | 0cf133f93d87cd6a2f2b6eb138f87e0b36ac8885 /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | ac76a6b40cace06c63c049be0ae9e58721048473 (diff) | |
[FIX] web: Make accessible with keyboard the delete button on o2m fields (#23719)
* [FIX] web: Make accessible with keyboard the delete button on o2m fields
Currently, the delete button in one2many fields (trash icon) is not
reachable when using the keyboard, because it's neither a link, nor a
button or any other interactable HTML element, but a `<span>`.
This change causes that button to be an actual HTML button keeping the
same appearance, so it may be reached when using the keyboard.
* [FIX] web: Modify test to expect button instead of span as o2m trash icon
Since buttons to delete records in o2m fields (the trash icon) were
changed from `<span>` to `<button>` to be able to access them with the
keyboard, the test need to be modified so it expect the new element
type and doesn't break.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 731de434121..933a76097d8 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -3890,12 +3890,12 @@ QUnit.module('relational_fields', { }); form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('td.o_list_record_delete span').length, 2, + assert.strictEqual(form.$('td.o_list_record_delete button').length, 2, "should have 2 delete buttons"); - form.$('td.o_list_record_delete span').first().click(); + form.$('td.o_list_record_delete button').first().click(); - assert.strictEqual(form.$('td.o_list_record_delete span').length, 1, + assert.strictEqual(form.$('td.o_list_record_delete button').length, 1, "should have 1 delete button (a record is supposed to have been unlinked)"); // save and check that the correct command has been generated @@ -3933,12 +3933,12 @@ QUnit.module('relational_fields', { }); form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('td.o_list_record_delete span').length, 2, + assert.strictEqual(form.$('td.o_list_record_delete button').length, 2, "should have 2 delete buttons"); - form.$('td.o_list_record_delete span').first().click(); + form.$('td.o_list_record_delete button').first().click(); - assert.strictEqual(form.$('td.o_list_record_delete span').length, 1, + assert.strictEqual(form.$('td.o_list_record_delete button').length, 1, "should have 1 delete button (a record is supposed to have been deleted)"); // save and check that the correct command has been generated @@ -6682,8 +6682,8 @@ QUnit.module('relational_fields', { form.$('input.o_field_integer[name="int_field"]').val('0').trigger('input'); // delete and start over - form.$('.o_list_record_delete:first span').click(); - form.$('.o_list_record_delete:first span').click(); + form.$('.o_list_record_delete:first button').click(); + form.$('.o_list_record_delete:first button').click(); // enable the many2many onchange form.$('input.o_field_integer[name="int_field"]').val('10').trigger('input'); @@ -8416,7 +8416,7 @@ QUnit.module('relational_fields', { mode: 'edit', }, }); - form.$('span[name="delete"]').first().click(); + form.$('button[name="delete"]').first().click(); assert.strictEqual(form.$('.o_data_row').text(), 'from onchange', 'onchange has been properly applied'); form.destroy(); @@ -8456,7 +8456,7 @@ QUnit.module('relational_fields', { mode: 'edit', }, }); - form.$('span[name="delete"]').first().click(); + form.$('button[name="delete"]').first().click(); assert.strictEqual(form.$('.o_data_row').text(), 'from onchange id2from onchange id3', 'onchange has been properly applied'); form.destroy(); |
