Skip to content

Commit

Permalink
refactoring and fixed test case
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Jun 28, 2024
1 parent 1582316 commit 1304e0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/containers/Template/Form/Template.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const hsmProps = {
languageStyle: 'dropdown',
formField: templateFormHSMFormFields,
setCategory: vi.fn(),
setExampleState: vi.fn(),
};

const hsmTemplateEdit = (templateId: string) => (
Expand Down
10 changes: 4 additions & 6 deletions src/containers/Template/Form/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,13 @@ const Template = ({
exampleBody = exampleValue;
}

if (setExampleState) {
setExampleState(exampleValue);
}
setExample(exampleValue);
setExampleState(exampleValue);
onExampleChange(exampleBody);
}
console.log('yes', hasButtons);

if (hasButtons) {
console.log('yes');

setIsAddButtonChecked(hasButtons);
}
if (typeValue && typeValue !== 'TEXT') {
Expand Down Expand Up @@ -318,7 +316,7 @@ const Template = ({
if (shortcodeValue) {
setTimeout(() => setShortcode(shortcodeValue), 0);
}
if (categoryValue) {
if (categoryValue && setCategory) {
setCategory({ label: categoryValue, id: categoryValue });
}
if (tagIdValue) {
Expand Down

0 comments on commit 1304e0e

Please sign in to comment.