Skip to content

Commit

Permalink
fix: ove test
Browse files Browse the repository at this point in the history
  • Loading branch information
jgespinosa10 committed Dec 11, 2024
1 parent 8b0ccd6 commit b352e4b
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 235 deletions.
4 changes: 2 additions & 2 deletions packages/ove/cypress/e2e/alignment.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe("alignment", function () {
cy.get("body").type("{shift}", { release: false });
cy.scrollAlignmentToPercent(0.99);
cy.contains(`[data-alignment-track-index="1"] text`, 3510).click();
cy.get(`[title="Selecting 3500 bps from 11 to 3510"]`);
cy.get(`[title="Selecting 3499 bps from 11 to 3509"]`);
});
it("the alignment should show axis numbers correctly", function () {
cy.visit("#/Alignment?alignmentDataId=39");
Expand All @@ -124,7 +124,7 @@ describe("alignment", function () {
cy.get("body").type("{shift}", { release: false });
cy.scrollAlignmentToPercent(0.99);
cy.contains(`[data-alignment-track-index="1"] text`, 3510).click();
cy.get(`[title="Selecting 3455 bps from 56 to 3510"]`);
cy.get(`[title="Selecting 3454 bps from 56 to 3509"]`);
});
it("scrolls the yellow scroll handle correctly", function () {
cy.visit("#/Alignment");
Expand Down
4 changes: 2 additions & 2 deletions packages/ove/cypress/e2e/editing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("editing", function () {
cy.contains("Caret Between Bases 5293 and 1");
cy.contains(".ve-row-item-sequence", "5'gtcttatga");
});
it(`should be able to insert data around the origin correctly
it(`should be able to insert data around the origin correctly
- new sequence should be inserted after the origin`, () => {
cy.selectRange(5297, 3);
cy.replaceSelection("aaaaaa");
Expand All @@ -68,7 +68,7 @@ describe("editing", function () {
cy.replaceSelection("tt");
cy.contains("Selecting 2 bps from 3 to 4");
});
it(`should be able to revComp, comp selections that wrap the origin correctly
it(`should be able to revComp, comp selections that wrap the origin correctly
- new sequence should be inserted after the origin`, () => {
cy.selectRange(5297, 3);
cy.contains("Jump to start").click();
Expand Down
4 changes: 2 additions & 2 deletions packages/ove/cypress/e2e/editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe("editor", function () {
cy.tgToggle("shouldAutosave");
cy.contains(".veRowViewPart", "Part 0").first().click();
cy.get(".veRowViewSelectionLayer").first().trigger("contextmenu");
cy.get(".bp3-menu-item").contains("Cut").click();
cy.get(".bp3-menu-item").contains("Cut").realClick();
cy.contains("onCopy callback triggered");
cy.contains("onSave callback triggered");
cy.contains("Selection Cut");
Expand All @@ -167,7 +167,7 @@ describe("editor", function () {
cy.get(".veRowViewSelectionLayer").first().trigger("contextmenu");
//tnrnote: cut in cypress only works on electron, not firefox or chrome

cy.get(".bp3-menu-item").contains("Cut").click();
cy.get(".bp3-menu-item").contains("Cut").realClick();
cy.contains("Selection Cut");
cy.get(".tg-menu-bar").contains("File").click();
cy.get(".bp3-menu-item").contains("Save As").click();
Expand Down
11 changes: 5 additions & 6 deletions packages/ove/cypress/e2e/menuBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ describe("menuBar", function () {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(0);
cy.focused().type("remove duplicate feature{enter}", { delay: 1 });
cy.contains(".rt-td", "dbl term").should("exist");
cy.contains(".bp3-dialog button", "Remove 2 Duplicates");
cy.get(".bp3-dialog .bp3-icon-settings").click();
cy.get(".tg-test-ignore-name .tg-no-fill-field").click();
Expand All @@ -204,7 +203,7 @@ describe("menuBar", function () {
cy.get(".tg-menu-bar-popover").contains("Select All").click();

cy.get(".tg-menu-bar").contains("Edit").click();
cy.get(".tg-menu-bar-popover").contains("Cut").click();
cy.get(".tg-menu-bar-popover").contains("Cut").realClick();
cy.get(".tg-menu-bar").contains("Edit").click({ force: true });

[
Expand Down Expand Up @@ -290,7 +289,7 @@ describe("menuBar", function () {
});
it(` goTo, rotateTo work
-can't go to a position outside of the sequence
-can go to a position inside the sequence
-can go to a position inside the sequence
-can rotate the sequence to that position
`, () => {
cy.get(".tg-menu-bar").contains("Edit").click();
Expand Down Expand Up @@ -329,7 +328,7 @@ describe("menuBar", function () {
it(`
select range, copy, cut works
-cannot select range outside of sequence //TODO
-can select a valid range
-can select a valid range
-can copy the select bps
-can cut the selected bps
`, function () {
Expand All @@ -348,10 +347,10 @@ describe("menuBar", function () {

cy.get(".veStatusBar").contains(`5299`);
cy.get(".tg-menu-bar").contains("Edit").click();
cy.get(".tg-menu-bar-popover").contains("Copy").click();
cy.get(".tg-menu-bar-popover").contains("Copy").realClick();
cy.contains("Selection Copied");
cy.get(".tg-menu-bar").contains("Edit").click();
cy.get(".tg-menu-bar-popover").contains("Cut").click();
cy.get(".tg-menu-bar-popover").contains("Cut").realClick();
cy.contains("Selection Cut");
cy.get(".veStatusBar").contains(`5288`);
});
Expand Down
104 changes: 48 additions & 56 deletions packages/ove/src/DigestTool/DigestTool.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// import uniqid from "shortid";
// import Ladder from "./Ladder";
import { compose, withProps } from "recompose";
// import selectionLayer from "../redux/selectionLayer";
import React, { useState } from "react";
import React, { useMemo, useState } from "react";
import { DataTable } from "@teselagen/ui";
import { getCutsiteType, getVirtualDigest } from "@teselagen/sequence-utils";
import CutsiteFilter from "../CutsiteFilter";
import Ladder from "./Ladder";
// import getCutsiteType from "./getCutsiteType";
import {
Tabs,
Tab,
Expand All @@ -27,18 +22,59 @@ export const DigestTool = props => {
const [selectedTab, setSelectedTab] = useState("virtualDigest");
const {
editorName,
// height = 100,
dimensions = {},
lanes,
digestTool: { selectedFragment, computePartialDigest },
onDigestSave,
computePartialDigestDisabled,
computeDigestDisabled,
updateComputePartialDigest,
boxHeight,
digestLaneRightClicked,
ladders
ladders,
sequenceData,
sequenceLength,
selectionLayerUpdate,
updateSelectedFragment
} = props;

const isCircular = sequenceData.circular;
const cutsites = sequenceData.cutsites;
const computePartialDigestDisabled =
cutsites.length > MAX_PARTIAL_DIGEST_CUTSITES;
const computeDigestDisabled = cutsites.length > MAX_DIGEST_CUTSITES;

const lanes = useMemo(() => {
const { fragments } = getVirtualDigest({
cutsites,
sequenceLength,
isCircular,
computePartialDigest,
computePartialDigestDisabled,
computeDigestDisabled
});
const lanes = [
fragments.map(f => ({
...f,
onFragmentSelect: () => {
selectionLayerUpdate({
start: f.start,
end: f.end,
name: f.name
});
updateSelectedFragment(f.Intentid);
}
}))
];
return lanes;
}, [
computeDigestDisabled,
computePartialDigest,
computePartialDigestDisabled,
cutsites,
isCircular,
selectionLayerUpdate,
sequenceLength,
updateSelectedFragment
]);

return (
<div
style={{
Expand Down Expand Up @@ -178,48 +214,4 @@ const schema = {
]
};

export default compose(
withEditorInteractions,
withProps(
({
sequenceData,
sequenceLength,
selectionLayerUpdate,
updateSelectedFragment,
digestTool: { computePartialDigest }
}) => {
const isCircular = sequenceData.circular;
const cutsites = sequenceData.cutsites;
const computePartialDigestDisabled =
cutsites.length > MAX_PARTIAL_DIGEST_CUTSITES;
const computeDigestDisabled = cutsites.length > MAX_DIGEST_CUTSITES;

const { fragments, overlappingEnzymes } = getVirtualDigest({
cutsites,
sequenceLength,
isCircular,
computePartialDigest,
computePartialDigestDisabled,
computeDigestDisabled
});
return {
computePartialDigestDisabled,
computeDigestDisabled,
lanes: [
fragments.map(f => ({
...f,
onFragmentSelect: () => {
selectionLayerUpdate({
start: f.start,
end: f.end,
name: f.name
});
updateSelectedFragment(f.Intentid);
}
}))
],
overlappingEnzymes
};
}
)
)(DigestTool);
export default withEditorInteractions(DigestTool);
Loading

0 comments on commit b352e4b

Please sign in to comment.