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]>

removed unwanted comment
  • Loading branch information
im-shiv authored and Gulshan Mishra committed Oct 10, 2023
1 parent 198921b commit dd5d609
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 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
2 changes: 0 additions & 2 deletions ui.tests/test-module/specs/switch/switch.authoring.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ describe('Page - Authoring', function () {
});

it('when enableUnchecked is false hides off field', function () {
// todo: Fix edit dialog bug before enabling this test
dropSwitchInContainer();
const pagePath = "/content/forms/af/core-components-it/blank",
switchEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/switch",
Expand Down Expand Up @@ -112,7 +111,6 @@ describe('Page - Authoring', function () {
});

it('when enableUnchecked is false hides off field', function () {
// todo: Fix edit dialog bug before enabling this test
dropSwitchInSites();
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + switchEditPathSelector);
cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
Expand Down

0 comments on commit dd5d609

Please sign in to comment.