FIX: Ensure expand table works regardless of click event target (#21373)
In the expand table event handler, we currently rely on `event.target` to select the table being expanded. Sometimes, the target is the svg icon wrapped inside the button instead of the button itself. This throws things off. This change uses `currentTarget` which refers to the button element even if the event originated from svg icon.
This commit is contained in:
parent
b75c17fe42
commit
0424eb8db2
|
@ -158,7 +158,7 @@ export default {
|
|||
}
|
||||
|
||||
function generateModal(event) {
|
||||
const table = event.target.parentElement.nextElementSibling;
|
||||
const table = event.currentTarget.parentElement.nextElementSibling;
|
||||
const tempTable = table.cloneNode(true);
|
||||
|
||||
showModal("fullscreen-table").set("tableHtml", tempTable);
|
||||
|
|
|
@ -37,6 +37,7 @@ acceptance("Post Table Wrapper Test", function () {
|
|||
await click(
|
||||
`${postWithLargeTable} .fullscreen-table-wrapper .btn-expand-table`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".fullscreen-table-modal"),
|
||||
"The fullscreen table modal appears"
|
||||
|
@ -45,5 +46,15 @@ acceptance("Post Table Wrapper Test", function () {
|
|||
exists(".fullscreen-table-modal table"),
|
||||
"The table is present inside the modal"
|
||||
);
|
||||
|
||||
await click(".fullscreen-table-modal .modal-close.close");
|
||||
await click(
|
||||
`${postWithLargeTable} .fullscreen-table-wrapper .btn-expand-table svg`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".fullscreen-table-modal"),
|
||||
"Fullscreen table modal appears on clicking svg icon"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue