Skip to content
17 changes: 16 additions & 1 deletion src/entry-editable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,27 @@
}

function getTagsValue(dataValue: string, tagsAsObject: boolean, appliedVariants: { _applied_variants: { [key: string]: any }, shouldApplyVariant: boolean, metaKey: string }): any {
if (appliedVariants.shouldApplyVariant && appliedVariants._applied_variants && appliedVariants._applied_variants[appliedVariants.metaKey]) {
if (appliedVariants.shouldApplyVariant && appliedVariants._applied_variants) {

Check warning on line 118 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
const isFieldVariantised = appliedVariants._applied_variants[appliedVariants.metaKey];

Check warning on line 119 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
if(isFieldVariantised) {
const variant = appliedVariants._applied_variants[appliedVariants.metaKey]
// Adding v2 prefix to the cslp tag. New cslp tags are in v2 format. ex: v2:content_type_uid.entry_uid.locale.title
const newDataValueArray = ('v2:' + dataValue).split('.');
newDataValueArray[1] = newDataValueArray[1] + '_' + variant;
dataValue = newDataValueArray.join('.');
}
else {
const variantisedFieldPaths = Object.keys(appliedVariants._applied_variants).sort((a, b) => {

Check warning on line 128 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
return b.length - a.length;

Check warning on line 129 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
});

Check warning on line 130 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const variantisedParentPath = variantisedFieldPaths.find(path => appliedVariants.metaKey.startsWith(path));

Check warning on line 131 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 131 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 131 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
Comment thread
hiteshshetty-dev marked this conversation as resolved.
Outdated
if(variantisedParentPath) {
const variant = appliedVariants._applied_variants[variantisedParentPath];

Check warning on line 133 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const newDataValueArray = ('v2:' + dataValue).split('.');

Check warning on line 134 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
newDataValueArray[1] = newDataValueArray[1] + '_' + variant;

Check warning on line 135 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
dataValue = newDataValueArray.join('.');

Check warning on line 136 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 137 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 137 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

Check warning on line 138 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 138 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 138 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

Check warning on line 139 in src/entry-editable.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
if (tagsAsObject) {
return { "data-cslp": dataValue };
Expand Down
Loading