Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:culturecreates/footlight-app int…
Browse files Browse the repository at this point in the history
…o bugfix/issue-1319
  • Loading branch information
AbhishekPAnil committed Sep 27, 2024
2 parents 4bdd03f + 7a260df commit 3fdc73a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/Sort/Sort.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function Sort(props) {
{sortByOptionsOrgsPlacesPerson?.map((sortBy, index) => {
if (sortBy?.key === filter?.sort)
return (
<span key={index} data-cy={`span-sort-option-${sortBy?.label}`}>
<span key={index} data-cy={`span-sort-option-${sortBy['data-cy']}`}>
{sortBy?.label}
</span>
);
Expand Down
30 changes: 18 additions & 12 deletions src/constants/formFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export const formFieldValue = [
return (
<div>
<Popover
data-cy={`popover-${mappedField}`}
data-cy={`popover-${mappedField ?? fieldName}`}
open={isPopoverOpen}
onOpenChange={(open) => setIsPopoverOpen(open)}
overlayClassName="event-popover"
Expand All @@ -441,7 +441,9 @@ export const formFieldValue = [
<div>
<div>
<>
<div className="popover-section-header" data-cy={`div-${mappedField}-footlight-place-title`}>
<div
className="popover-section-header"
data-cy={`div-${mappedField ?? fieldName}-footlight-place-title`}>
{t('dashboard.organization.createNew.search.footlightSectionHeading')}
</div>
<div className="search-scrollable-content">
Expand All @@ -464,7 +466,7 @@ export const formFieldValue = [
form.setFieldValue(fieldName, place?.value);
setIsPopoverOpen(false);
}}
data-cy={`div-${mappedField}-footlight-place-${index}`}>
data-cy={`div-${mappedField ?? fieldName}-footlight-place-${index}`}>
{place?.label}
</div>
))
Expand All @@ -474,7 +476,9 @@ export const formFieldValue = [
</div>
</>

<div className="popover-section-header" data-cy={`div-${mappedField}-footlight-place-title`}>
<div
className="popover-section-header"
data-cy={`div-${mappedField ?? fieldName}-footlight-place-title`}>
{t('dashboard.organization.createNew.search.importsFromFootlight')}
</div>
<div className="search-scrollable-content">
Expand All @@ -496,7 +500,7 @@ export const formFieldValue = [
form.setFieldValue(fieldName, place?.value);
setIsPopoverOpen(false);
}}
data-cy={`div-${mappedField}-footlight-place-${index}`}>
data-cy={`div-${mappedField ?? fieldName}-footlight-place-${index}`}>
{place?.label}
</div>
))
Expand All @@ -505,7 +509,9 @@ export const formFieldValue = [
))}
</div>

<div className="popover-section-header" data-cy={`div-${mappedField}-artsdata-place-title`}>
<div
className="popover-section-header"
data-cy={`div-${mappedField ?? fieldName}-artsdata-place-title`}>
{t('dashboard.organization.createNew.search.artsDataSectionHeading')}
</div>
<div className="search-scrollable-content">
Expand All @@ -525,7 +531,7 @@ export const formFieldValue = [
form.setFieldValue(fieldName, place?.uri);
setIsPopoverOpen(false);
}}
data-cy={`div-${mappedField}-artsdata-place-${index}`}>
data-cy={`div-${mappedField ?? fieldName}-artsdata-place-${index}`}>
{place?.label}
</div>
))
Expand All @@ -546,7 +552,7 @@ export const formFieldValue = [
onClick={() => {
setIsPopoverOpen(true);
}}
data-cy={`input-${mappedField}`}
data-cy={`input-${mappedField ?? fieldName}`}
/>
</Popover>
{locationPlace && (
Expand Down Expand Up @@ -626,7 +632,7 @@ export const renderFormFields = ({
<>
{position === 'top' && datatype !== dataTypes.IMAGE && <p className="add-event-date-heading">{userTips}</p>}
<Form.Item
data-cy={`form-item-${mappedField ?? fieldName}`}
data-cy={`form-item-${mappedField ?? fieldName?.toLowerCase()}`}
label={label}
name={name ?? fieldName?.toLowerCase()}
key={key}
Expand All @@ -642,7 +648,7 @@ export const renderFormFields = ({
required={required}
hidden={hidden}
style={style}
className={mappedField}
className={mappedField ?? fieldName?.toLowerCase()}
rules={rules
?.map((rule) => {
if (datatype === rule?.dataType) {
Expand All @@ -662,7 +668,7 @@ export const renderFormFields = ({
<p
className="add-event-date-heading"
style={{ marginTop: '-15px' }}
data-cy={`form-item-helper-text-${mappedField}`}>
data-cy={`form-item-helper-text-${mappedField ?? fieldName?.toLowerCase()}`}>
{userTips}
</p>
) : undefined
Expand Down Expand Up @@ -713,7 +719,7 @@ export const returnFormDataWithFields = ({
datatype: field?.datatype,
required: checkMandatoryAdminOnlyFields(field?.name, mandatoryFields),
element: formField?.element({
fieldName: field?.name,
fieldName: field?.name?.toLowerCase(),
mappedField: field?.mappedField,
data: entityData && entityData[field?.mappedField],
datatype: field?.datatype,
Expand Down
2 changes: 2 additions & 0 deletions src/constants/sortByOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export const sortByOptionsOrgsPlacesPerson = [
{
label: <Translation>{(t) => t('dashboard.events.filter.sort.name')}</Translation>,
key: `name`,
['data-cy']: 'name',
},
{
label: <Translation>{(t) => t('dashboard.taxonomy.listing.sort.createdDate')}</Translation>,
key: 'metadata.createdAt',
['data-cy']: 'createdDate',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,7 @@ function CreateNewOrganization() {
<Form.Item
key={index}
name={['dynamicFields', taxonomy?.id]}
data-cy={`form-item-organization-dynamic-fields-${index}`}
label={bilingual({
data: taxonomy?.name,
interfaceLanguage: user?.interfaceLanguage?.toLowerCase(),
Expand All @@ -1304,6 +1305,7 @@ function CreateNewOrganization() {
taxonomy?.isAdminOnly ? (adminCheckHandler({ calendar, user }) ? false : true) : false
}>
<TreeSelectOption
data-cy={`treeselect-organization-dynamic-fields-${index}`}
allowClear
treeDefaultExpandAll
notFoundContent={<NoContent />}
Expand All @@ -1317,6 +1319,7 @@ function CreateNewOrganization() {
const { label, closable, onClose } = props;
return (
<Tags
data-cy={`tag-organization-dynamic-field-${label}`}
closable={closable}
onClose={onClose}
closeIcon={
Expand Down
1 change: 1 addition & 0 deletions src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ function CreateNewPerson() {
<Form.Item
key={index}
name={['dynamicFields', taxonomy?.id]}
data-cy={`form-item-person-dynamic-fields-${index}`}
label={bilingual({
data: taxonomy?.name,
interfaceLanguage: user?.interfaceLanguage?.toLowerCase(),
Expand Down

0 comments on commit 3fdc73a

Please sign in to comment.