@bigbinary/neeto-commons-frontend 2.1.36 → 2.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cypress-utils.js CHANGED
@@ -125,6 +125,14 @@ var joinHyphenCase = function joinHyphenCase() {
125
125
  }
126
126
  return args.join(" ").replace(/\s+/g, "-").toLowerCase();
127
127
  };
128
+ var hyphenize = function hyphenize(input) {
129
+ var fallbackString = "";
130
+ if (typeof input === "number") return String(input);
131
+ if (input && typeof input === "string" && input.replace) {
132
+ return input.replace(/[\s_]/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/-+/g, "-").toLowerCase();
133
+ }
134
+ return fallbackString;
135
+ };
128
136
  var initializeCredentials = function initializeCredentials(stagingData) {
129
137
  cy.task("getGlobalState").then(function (state) {
130
138
  var newState = _objectSpread$2(_objectSpread$2({}, state), {}, {
@@ -188,7 +196,7 @@ var commonSelectors = {
188
196
  paneHeader: ".neeto-ui-pane__header",
189
197
  profileSidebar: ".neeto-ui-profile-sidebar",
190
198
  selectOption: function selectOption(label) {
191
- return dataCy("".concat(joinHyphenCase(label), "-select-option"));
199
+ return dataCy("".concat(hyphenize(label), "-select-option"));
192
200
  },
193
201
  toastMessage: dataCy("toastr-message-container"),
194
202
  toastCloseButton: ".neeto-ui-toastr__close-button",
@@ -358,7 +366,7 @@ var initCustomCommands = function initCustomCommands() {
358
366
  });
359
367
  Cypress.Commands.add("selectOption", function (containerSelector, optionText) {
360
368
  cy.get(containerSelector).click().type(optionText);
361
- cy.get(commonSelectors.selectOption(optionText.split("_").join("-").toLowerCase())).invoke("click");
369
+ cy.get(commonSelectors.selectOption(optionText)).invoke("click");
362
370
  });
363
371
  Cypress.Commands.add("clickDropdownOption", function (optionText) {
364
372
  var dropdownSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : commonSelectors.dropdownIcon;
@@ -1715,5 +1723,5 @@ var emailUtils = {
1715
1723
  sendEmail: sendEmail
1716
1724
  };
1717
1725
 
1718
- export { authUtils, chatWidgetSelectors, commonSelectors, commonTexts, createOrganization, dataCy, dataTestId, dateUtils, emailUtils, env, environment, fake, getTestTitle, getUrl, helpIconSelectors, helpIconTexts, initCustomCommands, initializeCredentials, isStagingEnv, joinHyphenCase, loginSelectors, memberFormErrorTexts, memberFormSelectors, memberSelectors, memberTableTexts, memberTexts, memberUtils, navigationUtils, profileSelectors, profileTexts, sendEmail, setListCount, signUpSelectors, signUpTexts, tableSelectors, verifyCrossSiteScript, verifyListCount };
1726
+ export { authUtils, chatWidgetSelectors, commonSelectors, commonTexts, createOrganization, dataCy, dataTestId, dateUtils, emailUtils, env, environment, fake, getTestTitle, getUrl, helpIconSelectors, helpIconTexts, hyphenize, initCustomCommands, initializeCredentials, isStagingEnv, joinHyphenCase, loginSelectors, memberFormErrorTexts, memberFormSelectors, memberSelectors, memberTableTexts, memberTexts, memberUtils, navigationUtils, profileSelectors, profileTexts, sendEmail, setListCount, signUpSelectors, signUpTexts, tableSelectors, verifyCrossSiteScript, verifyListCount };
1719
1727
  //# sourceMappingURL=cypress-utils.js.map