From dd8c68d33551b37429aa79210d1ec40517f30f63 Mon Sep 17 00:00:00 2001 From: Blesilda Ramirez Date: Sun, 17 Nov 2024 23:59:00 +0800 Subject: [PATCH] pkp/pkp-lib#10444 Improve dialog component design (#89) * pkp/pkp-lib#10444 Add modalStyle when using dialog component * pkp/pkp-lib#10444 Adjust cypress test to click the Appearance tab first before clicking its content * pkp/pkp-lib#10444 [cypress] Reload website page after adding new customBlock * pkp/pkp-lib#10444 Change modalStyle value when opening custom block modal * pkp/pkp-lib#10444 Remove modalStyle param when using AjaxModal class --- CustomBlockManagerPlugin.php | 2 +- controllers/grid/CustomBlockGridHandler.php | 1 - controllers/grid/CustomBlockGridRow.php | 4 ++-- cypress/tests/functional/CustomBlocks.cy.js | 11 +++++------ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CustomBlockManagerPlugin.php b/CustomBlockManagerPlugin.php index 7de8848..89f433f 100644 --- a/CustomBlockManagerPlugin.php +++ b/CustomBlockManagerPlugin.php @@ -126,7 +126,7 @@ public function getActions($request, $actionArgs): array 'category' => $this->getCategory(), 'action' => 'index' ]), - $this->getDisplayName() + $this->getDisplayName(), ); return array_merge([new LinkAction('settings', $ajaxModal, __('plugins.generic.customBlockManager.manage'))], $actions); } diff --git a/controllers/grid/CustomBlockGridHandler.php b/controllers/grid/CustomBlockGridHandler.php index 9738a32..a82804d 100644 --- a/controllers/grid/CustomBlockGridHandler.php +++ b/controllers/grid/CustomBlockGridHandler.php @@ -106,7 +106,6 @@ public function initialize($request, $args = null) new AjaxModal( $router->url($request, null, null, 'addCustomBlock'), __('plugins.generic.customBlockManager.addBlock'), - 'modal_add_item' ), __('plugins.generic.customBlockManager.addBlock'), 'add_item' diff --git a/controllers/grid/CustomBlockGridRow.php b/controllers/grid/CustomBlockGridRow.php index 3b36bd1..aea7636 100644 --- a/controllers/grid/CustomBlockGridRow.php +++ b/controllers/grid/CustomBlockGridRow.php @@ -46,7 +46,7 @@ public function initialize($request, $template = null) new AjaxModal( $router->url($request, null, null, 'editCustomBlock', null, ['blockName' => $blockName]), __('grid.action.edit'), - 'modal_edit', + null, true ), __('grid.action.edit'), @@ -63,7 +63,7 @@ public function initialize($request, $template = null) __('common.confirmDelete'), __('grid.action.delete'), $router->url($request, null, null, 'deleteCustomBlock', null, ['blockName' => $blockName]), - 'modal_delete' + 'negative' ), __('grid.action.delete'), 'delete' diff --git a/cypress/tests/functional/CustomBlocks.cy.js b/cypress/tests/functional/CustomBlocks.cy.js index 426b5f0..38e521d 100644 --- a/cypress/tests/functional/CustomBlocks.cy.js +++ b/cypress/tests/functional/CustomBlocks.cy.js @@ -36,12 +36,11 @@ describe('Custom Block Manager plugin tests', function() { cy.wait(500); // Make sure the form has closed cy.get('[role="dialog"] button:contains(\'Close\')').click(); - // FIXME: The settings area has to be reloaded before the new block will appear.a - // This click should be unnecessary. - cy.get('nav').contains('Settings').click(); - // Ensure submenu item click despite animation - cy.get('nav').contains('Website').click({ force: true }); - cy.get('#appearance > .pkpTabs > .pkpTabs__buttons > #appearance-setup-button').click(); + cy.reload(); + cy.waitJQuery(); + + cy.get('button[id="appearance-button"]').click(); + cy.get('#appearance-setup-button').click(); cy.get('#appearance-setup span:contains("test-custom-block"):first').click(); cy.get('#appearance-setup button:contains("Save")').click(); cy.waitJQuery();