Skip to content

Commit

Permalink
Auto apply parent model by rendering hidden item parent component (#3035
Browse files Browse the repository at this point in the history
)
  • Loading branch information
agalin920 authored Oct 24, 2024
1 parent 0f4d085 commit 5b96338
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
23 changes: 23 additions & 0 deletions cypress/e2e/content/meta.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,27 @@ describe("Content Meta", () => {
cy.get("#SaveItemButton").click();
cy.getBySelector("FieldErrorsList").should("exist");
});

it("Auto applies page parent when creating an item", () => {
cy.waitOn("/v1/content/models*", () => {
cy.waitOn("/v1/env/nav", () => {
cy.waitOn("/v1/search/items*", () => {
cy.visit("/content/6-0c960c-d1n0kx/new");
});
});
});

cy.iframe("#wysiwyg_basic_ifr")
.click()
.type(`{selectall}{backspace}meta description`);
cy.get("#12-849844-t8v5l6").find("input").type(`meta title ${today}`);

cy.getBySelector("CreateItemSaveButton").click();

cy.waitOn("/v1/content/models*", () => {
cy.get('[role="tablist"]').find("button").eq(1).click();
});

cy.contains("/page/otherpage/all-field-types/").should("exist");
});
});
3 changes: 3 additions & 0 deletions src/apps/content-editor/src/app/views/ItemEdit/Meta/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ export const Meta = forwardRef(
))}
</Stack>
</Box>
<Box sx={{ display: "none" }}>
<ItemParent onChange={handleOnChange} />
</Box>
</ThemeProvider>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const ItemParent = ({ onChange }: ItemParentProps) => {
});
}
}
}, []);
}, [rawNavData]);

return (
<Box id="parentZUID">
Expand Down

0 comments on commit 5b96338

Please sign in to comment.