Skip to content

Commit

Permalink
#4154 - Cannot select bonds when we add molecule with addFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-asiyuk-epam committed Mar 5, 2024
1 parent 31f816e commit 9596f54
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,30 @@ test.describe('RNA Library', () => {
Test is not working properly. Need fix bug https://github.com/epam/ketcher/issues/3489
*/
const monomers = [
{ type: 'sugar', name: "3A6___6-amino-hexanol (3' end)" },
{ type: 'base', name: 'baA___N-benzyl-adenine' },
{ type: 'phosphate', name: 'bP___Boranophosphate' },
{
type: 'sugar',
groupName: 'Sugars',
name: "3A6___6-amino-hexanol (3' end)",
},
{ type: 'base', groupName: 'Bases', name: 'baA___N-benzyl-adenine' },
{
type: 'phosphate',
groupName: 'Phosphates',
name: 'bP___Boranophosphate',
},
];

await expandCollapseRnaBuilder(page);

for (const monomer of monomers) {
await page.getByTestId(`rna-builder-slot--${monomer.type}`).click();
await page.getByTestId(monomer.name).click();
await page
.getByTestId(`rna-accordion-details-${monomer.groupName}`)
.hover();
await page.mouse.wheel(0, 0);
await clickInTheMiddleOfTheScreen(page);
await takeMonomerLibraryScreenshot(page);
await takeMonomerLibraryScreenshot(page, { maxDiffPixelRatio: 0.03 });
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ test.describe('Template Manupulations', () => {
await page.getByTestId('canvas').getByText('S').first().click({
button: 'right',
});
await takeEditorScreenshot(page);
await page.getByText('Edit...').click();
await page.getByLabel('Label').click();
await page.getByLabel('Label').fill('Br');
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export const RnaAccordion = ({ libraryName, duplicatePreset, editPreset }) => {
<StyledAccordion
key={groupData.groupName}
data-testid="styled-accordion"
dataTestIdDetails={`rna-accordion-details-${groupData.groupName}`}
summary={summary}
details={details}
expanded={expanded}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ exports[`Test Rna Accordion component should render 1`] = `
</div>
<div
class="css-4wpvad"
data-testid="rna-accordion-details-Sugars"
>
<div
class="css-9bccu"
Expand Down Expand Up @@ -219,6 +220,7 @@ exports[`Test Rna Accordion component should render 1`] = `
</div>
<div
class="css-4wpvad"
data-testid="rna-accordion-details-Bases"
>
<div
class="css-9bccu"
Expand Down Expand Up @@ -287,6 +289,7 @@ exports[`Test Rna Accordion component should render 1`] = `
</div>
<div
class="css-4wpvad"
data-testid="rna-accordion-details-Phosphates"
>
<div
class="css-9bccu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ export const Accordion = ({
expanded,
className,
onSummaryClick,
dataTestIdDetails,
}: IAccordionProps) => {
return (
<Container className={className}>
<SummaryContainer onClick={onSummaryClick}>{summary}</SummaryContainer>
<DetailsContainer expanded={expanded}>{details}</DetailsContainer>
<DetailsContainer data-testid={dataTestIdDetails} expanded={expanded}>
{details}
</DetailsContainer>
</Container>
);
};
1 change: 1 addition & 0 deletions packages/ketcher-react/src/components/Accordion/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IAccordionProps {
expanded: boolean;
onSummaryClick: React.MouseEventHandler<HTMLDivElement>;
className?: string;
dataTestIdDetails?: string;
}

export interface IDetailsContainerProps {
Expand Down
4 changes: 4 additions & 0 deletions packages/ketcher-react/src/script/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ class Editor implements KetcherEditor {
structToAddFragment(value: Struct): Struct {
const superStruct = value.mergeInto(this.render.ctab.molecule);

setTimeout(() => {
this.selection('all');
this.selection(null);
}, 0);
return this.renderAndRecoordinateStruct(superStruct);
}

Expand Down

0 comments on commit 9596f54

Please sign in to comment.