Skip to content

Commit

Permalink
FORMS-11284 fixing enum name display on hide (#911)
Browse files Browse the repository at this point in the history
* FORMS-11284 fixing enum name display on hide

* FORMS-11284 adding test case

---------

Co-authored-by: Shivam Agarwal <[email protected]>
  • Loading branch information
2 people authored and barshatr committed Oct 13, 2023
1 parent 4ca06a5 commit 6211ea7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
BASE_WRAPPER_VALUE_RICH_TEXT_TITLE = "[data-cq-richtext-editable='true'][data-wrapperclass='" + BASE_RICH_TEXT_TITLE_NAME + "']",
BASE_IS_TITLE_RICH_TEXT = ".cmp-adaptiveform-base__istitlerichtext",
BASE_RICH_TEXT_ENUMNAMES_NAME = "cmp-adaptiveform-base__richTextEnumNames",
BASE_RICH_TEXT_ENUMNAMES = "." + BASE_RICH_TEXT_ENUMNAMES_NAME,
BASE_WRAPPER_INPUT_RICH_TEXT_ENUMNAMES = "[data-cq-richtext-input='true'][data-wrapperclass='" + BASE_RICH_TEXT_ENUMNAMES_NAME + "']",
BASE_WRAPPER_VALUE_RICH_TEXT_ENUMNAMES = "[data-cq-richtext-editable='true'][data-wrapperclass='" + BASE_RICH_TEXT_ENUMNAMES_NAME + "']",
BASE_ARE_OPTIONS_RICH_TEXT = ".cmp-adaptiveform-base__areOptionsRichText",
Expand Down Expand Up @@ -200,7 +201,7 @@
*/
function resolveRichTextOptions(dialog, areOptionsRichText, isToggled) {
let enumNames = dialog.find(BASE_ENUMNAMES_VISIBLE),
richTextEnumNames = dialog.find(BASE_WRAPPER_INPUT_RICH_TEXT_ENUMNAMES),
richTextEnumNames = dialog.find(BASE_RICH_TEXT_ENUMNAMES),
richTextEnumNamesDiv = dialog.find("[data-cq-richtext-editable='true'][data-wrapperclass='cmp-adaptiveform-base__richTextEnumNames']");
if(areOptionsRichText != null && areOptionsRichText.checked){
for (let i = 0; i < richTextEnumNames.length; i++) {
Expand Down Expand Up @@ -298,7 +299,7 @@
channel.on("click", BASE_ENUM_MULTIFIELD_ADD_BUTTON, function (e) {
let areOptionsRichText = $(BASE_ARE_OPTIONS_RICH_TEXT)[0],
enumNames = $(BASE_ENUMNAMES_VISIBLE),
richTextEnumNames = $(BASE_WRAPPER_INPUT_RICH_TEXT_ENUMNAMES);
richTextEnumNames = $(BASE_RICH_TEXT_ENUMNAMES);
if(areOptionsRichText != null && areOptionsRichText.checked){
for (let i = 0; i < richTextEnumNames.length; i++) {
Utils.hideComponent(enumNames[i], "div");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ describe('Page - Authoring', function () {
cy.get("div[name='richTextTitle']").should('be.visible');

// check rich text selector and see if RTE is visible for enum names.
cy.get(".cmp-adaptiveform-base__richTextEnumNames").first().should('not.be.visible');
cy.get('.cmp-adaptiveform-base__areOptionsRichText').should('exist').click();
cy.get("div[name='richTextEnumNames']").then(($el) => {
$el[0].scrollIntoView();
})
cy.get("div[name='richTextEnumNames']").first().should('be.visible');
cy.get(".cmp-adaptiveform-base__richTextEnumNames").first().should('be.visible');
cy.get('.cq-dialog-submit').click();
});

Expand Down

0 comments on commit 6211ea7

Please sign in to comment.