Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,25 @@ test.describe('Macromolecules custom presets', () => {

await takeEditorScreenshot(page);
});

test('Create two presets with same component codes should create separate entries', async ({
page,
}) => {
// Create Preset A
await Library(page).selectMonomers([Sugar._25R, Base.baA, Phosphate.bP]);
await moveMouseToTheMiddleOfTheScreen(page);
await Library(page).rnaBuilder.addToPresets();

await takeMonomerLibraryScreenshot(page);

// Create Preset B with same component codes but different name
await Library(page).rnaBuilder.expand();

await Library(page).selectMonomers([Sugar._25R, Base.baA, Phosphate.bP]);
await moveMouseToTheMiddleOfTheScreen(page);
await Library(page).rnaBuilder.addToPresets();

// Both presets should exist as separate entries in the library
await takeMonomerLibraryScreenshot(page);
});
});
51 changes: 0 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,38 @@ const MonomerCreationWizard = () => {
const structure = editor.structSelected(wizardState.structure);
const { values: valuesToSave } = wizardState;

// For base component, always validate that mandatory Natural analogue field is filled
if (
rnaComponentKey === 'base' &&
isNaturalAnalogueRequired(valuesToSave.type) &&
!valuesToSave.naturalAnalogue?.trim()
) {
needSaveMonomers = false;
rnaPresetWizardStateDispatch({
type: 'SetErrors',
errors: {
naturalAnalogue: true,
},
rnaComponentKey,
editor,
});
rnaPresetWizardStateDispatch({
type: 'SetNotifications',
notifications: new Map([
[
'emptyMandatoryFields',
{
type: 'error',
message: NotificationMessages.emptyMandatoryFields,
},
],
]),
rnaComponentKey,
editor,
});
return;
}

// Check if all mandatory properties are filled
// If not, we'll auto-assign properties instead of validating
const hasMandatoryProperties =
Expand Down Expand Up @@ -1357,7 +1389,7 @@ const MonomerCreationWizard = () => {
return;
}
}
// If no mandatory properties filled, skip validation - properties will be auto-assigned
// If no mandatory properties filled (but not base with empty naturalAnalogue), skip validation - properties will be auto-assigned

const structureNotifications = validateStructure(structure, editor);
if (structureNotifications.size > 0) {
Expand Down
Loading