-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VACMS-14955: Hide ief_reference_save button for CLP (#16585)
* VACMS-14955: Hide ief_reference_save button for CLP * VACMS-14955: Moves IEF form modification to va_gov_entity_browser. * VACMS-14955: Adds entity browser cucumber assertions. * VACMS-14955: Adds test for add new downloadable resource button style change when using Entity Browser. --------- Co-authored-by: Jill Adams <[email protected]> Co-authored-by: Daniel Sasser <[email protected]>
- Loading branch information
1 parent
b06e6f7
commit 3e70254
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
docroot/modules/custom/va_gov_entity_browser/va_gov_entity_browser.module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains va_gov_entity_browser.module. | ||
*/ | ||
|
||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Implements hook_inline_entity_form_reference_form_alter(). | ||
*/ | ||
function va_gov_entity_browser_inline_entity_form_reference_form_alter(array &$reference_form, FormStateInterface &$form_state): void { | ||
// Hide IEF save button when using Entity Browser. | ||
if (!empty($reference_form['entity_browser']) && !empty($reference_form['actions']['ief_reference_save'])) { | ||
$reference_form['actions']['ief_reference_save']['#attributes']['style'] = 'display: none;'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/cypress/integration/step_definitions/common/i_select_from_entity_browser.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Given } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
Given(`I select one item from the {string} Entity Browser modal`, (text) => { | ||
cy.contains(text).click({ force: true }); | ||
cy.get(".entity-browser-modal iframe").should("exist"); | ||
cy.wait(3000); | ||
|
||
cy.get(".entity-browser-modal iframe") | ||
.iframe() | ||
.within(() => { | ||
cy.get("tr") | ||
.should("exist") | ||
.parent() | ||
.find("[type='checkbox']") | ||
.first() | ||
.check({ force: true }); | ||
cy.get("#edit-submit").click({ force: true }); | ||
}); | ||
cy.get(".entity-browser-modal iframe").should("not.exist"); | ||
}); | ||
|
||
Given( | ||
`I select {int} items from the {string} Entity Browser modal`, | ||
(numItems, text) => { | ||
cy.contains(text).click({ force: true }); | ||
cy.get(".entity-browser-modal iframe").should("exist"); | ||
cy.wait(3000); | ||
cy.get(".entity-browser-modal iframe") | ||
.iframe() | ||
.within(() => { | ||
for (let i = 0; i < numItems; i++) { | ||
cy.get("input[type='checkbox']") | ||
.eq(i) | ||
.should("exist") | ||
.check({ force: true }); | ||
} | ||
cy.get("#edit-submit").click({ force: true }); | ||
}); | ||
cy.get(".entity-browser-modal iframe").should("not.exist"); | ||
} | ||
); |