Skip to content

Commit 5343817

Browse files
committed
added logic in internal link component to check if item has meta data since the test fails if data is not yet fetch
1 parent 84c94c8 commit 5343817

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

cypress/e2e/content/actions.spec.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ describe("Actions in content editor", () => {
232232
cy.visit(`/content/${HOMEPAGE.modelZUID}/new`);
233233
});
234234

235-
cy.get("#12-0c3934-8dz720 input", TIMEOUT).should(
235+
cy.get('[data-cy="field:title"] input', TIMEOUT).should(
236236
"have.value",
237237
"default single line text field"
238238
);
239-
cy.get("#12-d39a38-85sqdt", TIMEOUT).contains(
239+
cy.get('[data-cy="field:image"]', TIMEOUT).contains(
240240
"zesty-io-logo-horizontal-dark.png"
241241
);
242-
cy.get("#12-bcd1dcc5f4-2rpm9p", TIMEOUT).contains(
242+
cy.get('[data-cy="field:habibi"]', TIMEOUT).contains(
243243
"5 Tricks to Teach Your Pitbull: Fun & Easy Tips for You & Your Dog!"
244244
);
245245
});
@@ -249,12 +249,14 @@ describe("Actions in content editor", () => {
249249
cy.visit(`/content/${HOMEPAGE.modelZUID}/new`);
250250
});
251251

252-
cy.get("#12-0c3934-8dz720 input", TIMEOUT).should(
252+
cy.get('[data-cy="field:title"] input', TIMEOUT).should(
253253
"have.value",
254254
"default single line text field"
255255
);
256-
cy.get("#12-d39a38-85sqdt").contains("zesty-io-logo-horizontal-dark.png");
257-
cy.get("#12-bcd1dcc5f4-2rpm9p").contains(
256+
cy.get('[data-cy="field:image"]', TIMEOUT).contains(
257+
"zesty-io-logo-horizontal-dark.png"
258+
);
259+
cy.get('[data-cy="field:habibi"]', TIMEOUT).contains(
258260
"5 Tricks to Teach Your Pitbull: Fun & Easy Tips for You & Your Dog!"
259261
);
260262
});

src/apps/content-editor/src/app/components/Editor/Field/InternalLink.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const InternalLink = ({
3030
useEffect(() => {
3131
// Resolve the itemZUID in case it isn't in the store cache
3232
if (
33-
!internalLinkRelatedItem &&
33+
// make sure that internalLinkRelatedItem from store has meta data
34+
!internalLinkRelatedItem?.meta?.ZUID &&
3435
zuid.isValid(value) &&
3536
zuid.matches(value, zuid.prefix["SITE_CONTENT_ITEM"])
3637
) {

0 commit comments

Comments
 (0)