Skip to content

Commit 05e6a85

Browse files
kpustakhodclaude
andauthored
#2198 Fix Save button enabled when Molecule name contains only spaces (#10284)
* #2198 Fix Save button enabled when Molecule name contains only spaces * #2198 Update snapshot for custom templates test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * #2198 - Remove 'Edit templates - name with just spaces' test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c0d4051 commit 05e6a85

4 files changed

Lines changed: 2 additions & 18 deletions

File tree

Loading

ketcher-autotests/tests/specs/Templates/Template-Library/template-library.spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,6 @@ test.describe('Templates - Template Library', () => {
113113
await clickInTheMiddleOfTheCanvas(page);
114114
await takeEditorScreenshot(page);
115115
});
116-
117-
test('Edit templates - name with just spaces', async ({ page }) => {
118-
// Test case: EPMLSOPKET-1699
119-
// Verify if structure name won't change if field will contain just spaces
120-
const inputText = ' ';
121-
await BottomToolbar(page).structureLibrary();
122-
await StructureLibraryDialog(page).editTemplate(
123-
TemplateLibraryTab.BetaDSugars,
124-
BetaDSugarsTemplate.BetaDAllopyranose,
125-
);
126-
await TemplateEditDialog(page).setMoleculeName(inputText);
127-
await TemplateEditDialog(page).edit();
128-
await StructureLibraryDialog(page).openTemplateLibrarySection(
129-
TemplateLibraryTab.BetaDSugars,
130-
);
131-
await takeEditorScreenshot(page);
132-
});
133116
});
134117

135118
test.describe('Templates - Template Library', () => {

packages/ketcher-react/src/script/ui/data/schema/struct-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ export const attachSchema: StructSchema = {
517517
minLength: 1,
518518
maxLength: 128,
519519
invalidMessage:
520-
'Template must have a unique name and no more than 128 symbols in length',
520+
'Template must have a unique non-empty name and no more than 128 symbols in length',
521521
},
522522
},
523523
};

packages/ketcher-react/src/script/ui/dialog/template/template-attach.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class Attach extends Component<AttachProps> {
277277
checkIsValidName(name: string) {
278278
return (
279279
!!name &&
280+
name.trim().length > 0 &&
280281
!this.props.templateLib.some(
281282
(tmpl) =>
282283
tmpl.struct.name === name && tmpl.props.group === 'User Templates',

0 commit comments

Comments
 (0)