From bf1fb5ed083e24ec8430edc34ffb54ea50935ff3 Mon Sep 17 00:00:00 2001 From: Thomas Rich Date: Thu, 17 Jun 2021 12:09:05 -0700 Subject: [PATCH] fixing more tests --- README.md | 2 +- cypress/integration/copyPaste.spec.js | 14 -------------- cypress/integration/demo.spec.js | 8 ++++++-- cypress/integration/rna.spec.js | 6 +++--- demo/src/EditorDemo/index.js | 14 +++++++++++++- src/updateEditor.js | 2 +- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9e0f0860f..0bb8a4fda 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,7 @@ They look like this: # Protein Editor OVE can be set up to view and edit proteins (Amino Acid sequences) as first class citizens. -The protein editor can be seen here: http://teselagen.github.io/openVectorEditor/#/Editor?isProtein=true +The protein editor can be seen here: http://teselagen.github.io/openVectorEditor/#/Editor?moleculeType=Protein The editor supports Amino Acid sequences as well as DNA sequences! Protein sequence mode is enabled by calling updateEditor with a protein sequenceData object: diff --git a/cypress/integration/copyPaste.spec.js b/cypress/integration/copyPaste.spec.js index 7b4e5dcf0..bf5d07393 100644 --- a/cypress/integration/copyPaste.spec.js +++ b/cypress/integration/copyPaste.spec.js @@ -2,20 +2,6 @@ describe("copyPaste", function () { beforeEach(() => { cy.visit(""); }); - // it(`isProtein mode - copy via hotkey`, () => { - // cy.contains(".tg-menu-bar button", "Edit").click(); - // cy.contains(".bp3-menu-item", "Copy").click(); - // cy.window().then(() => { - // assert( - // window.Cypress.textToCopy === - // "FCILLAAVSGAEGWGYYGCDEELVGPLYARSLGASSYYSLLTAPRFARLHGISGWSPRIGDPNPWLQIDLMKKHRIRAVATQGSFNSWDWVTRYMLLYGDRVDSWTPFYQRGHNSTFFGNVNESAVVRHDLHFHFTARYIRIVPLAWNPRGKIGLRLGLYGCPYKADILYFDGDDAISYRFPRGVSRSLWDVFAFSFKTEEKDGLLLHAEGAQGDYVTLELEGAHLLLHMSLGSSPIQPRPGHTTVSAGGVLNDQHWHYVRVDRFGRDVNFTLDGYVQRFILNGDFERLNLDTEMFIGGLVGAARKNLAYRHNFRGCIENVIFNRVNIADLAVRRHSRITFEGKVAFRCLDPVPHPINFGGPHNFVQVPGFPRRGRLAVSFRFRTWDLTGLLLFSRLGDGLGHVELTLSEGQVNVSIAQSGRKKLQFAAGYRLNDGFWHEVNFVAQENHAVISIDDVEGAEVRVSYPLLIRTGTSYFFGGCPKPASRWDCHSNQTAFHGCMELLKVDGQLVNLTLVEGRRLGFYAEVLFDTCGITDRCSPNMCEHDGRCYQSWDDFICYCELTGYKGETCHTPLYKESCEAYRLSGKTSGNFTIDPDGSGPLKPFVVYCDIRENRAWTVVRHDRLWTTRVTGSSMERPFLGAIQYWNASWEEVSALANASQHCEQWIEFSCYNSRLLNTAGGYPYSFWIGRNEEQHFYWGGSQPGIQRCACGLDRSCVDPALYCNCDADQPQWRTDKGLLTFVDHLPVTQVVIGDTNRSTSEAQFFLRPLRCYGDRNSWNTISFHTGAALRFPPIRANHSLDVSFYFRTSAPSGVFLENMGGPYCQWRRPYVRVELNTSRDVVFAFDVGNGDENLTVHSDDFEFNDDEWHLVRAEINVK" - // ); - // assert( - // window.Cypress.seqDataToCopy.proteinSequence === - // "fcillaavsgaegwgyygcdeelvgplyarslgassyyslltaprfarlhgisgwsprigdpnpwlqidlmkkhriravatqgsfnswdwvtrymllygdrvdswtpfyqrghnstffgnvnesavvrhdlhfhftaryirivplawnprgkiglrlglygcpykadilyfdgddaisyrfprgvsrslwdvfafsfkteekdglllhaegaqgdyvtlelegahlllhmslgsspiqprpghttvsaggvlndqhwhyvrvdrfgrdvnftldgyvqrfilngdferlnldtemfigglvgaarknlayrhnfrgcienvifnrvniadlavrrhsritfegkvafrcldpvphpinfggphnfvqvpgfprrgrlavsfrfrtwdltglllfsrlgdglghveltlsegqvnvsiaqsgrkklqfaagyrlndgfwhevnfvaqenhavisiddvegaevrvsypllirtgtsyffggcpkpasrwdchsnqtafhgcmellkvdgqlvnltlvegrrlgfyaevlfdtcgitdrcspnmcehdgrcyqswddficyceltgykgetchtplykesceayrlsgktsgnftidpdgsgplkpfvvycdirenrawtvvrhdrlwttrvtgssmerpflgaiqywnasweevsalanasqhceqwiefscynsrllntaggypysfwigrneeqhfywggsqpgiqrcacgldrscvdpalycncdadqpqwrtdkglltfvdhlpvtqvvigdtnrstseaqfflrplrcygdrnswntisfhtgaalrfppiranhsldvsfyfrtsapsgvflenmggpycqwrrpyvrvelntsrdvvfafdvgngdenltvhsddfefnddewhlvraeinvk" - // ); - // }); - // }); it(`isProtein mode - copy genbank of protein`, () => { cy.get(`[data-test="moleculeType"]`).select("Protein"); diff --git a/cypress/integration/demo.spec.js b/cypress/integration/demo.spec.js index fd85cc10a..d9cfe8ede 100644 --- a/cypress/integration/demo.spec.js +++ b/cypress/integration/demo.spec.js @@ -1,9 +1,13 @@ describe("demo", function () { it(`users should be able to search the options in the demo`, () => { cy.visit(""); - cy.contains(`.toggle-button-holder`, "isProtein").should("exist"); + cy.contains(`.toggle-button-holder`, "Show Rotate Circular View").should( + "exist" + ); cy.get(`[placeholder="Search Options.."]`).type("Custom"); - cy.contains(`.toggle-button-holder`, "isProtein").should("not.exist"); + cy.contains(`.toggle-button-holder`, "Show Rotate Circular View").should( + "not.exist" + ); cy.contains(`.toggle-button-holder`, "Customize property tabs").should( "exist" ); diff --git a/cypress/integration/rna.spec.js b/cypress/integration/rna.spec.js index 7df0b226e..d13f1961c 100644 --- a/cypress/integration/rna.spec.js +++ b/cypress/integration/rna.spec.js @@ -4,17 +4,17 @@ describe("rna editing in OVE", function () { }); it(`should support rna editing`, () => { - cy.tgToggle(`isRna`); + cy.get(`[data-test="moleculeType"]`).select("RNA"); cy.contains("uuaugacaacuugacggcuacaucauucacuuuuucuuca"); cy.selectRange(10, 11); - cy.get(".veSelectionLayer").first().rightclick(); + cy.get(".veSelectionLayer").first().rightclick({ force: true }); cy.contains(".bp3-menu-item", "Replace").click(); cy.focused().type("tguugttuuuuuuuuuuuuuuuaa{enter}"); cy.contains("Selecting 21 bps from 10 to 30"); //the t's should be filtered out cy.contains("guuguuuuuuuuuuuuuuuaa"); }); it(`should support mixed rna and dna editing`, () => { - cy.tgToggle(`isMixedRnaAndDna`); + cy.get(`[data-test="moleculeType"]`).select("mixedRnaAndDna"); cy.contains("uuaugacaacuugacggcuacaucauucacuuuuucuuca").should("not.exist"); cy.contains("uuuugacgt"); cy.selectRange(10, 11); diff --git a/demo/src/EditorDemo/index.js b/demo/src/EditorDemo/index.js index 6f87bac70..75db16a3d 100644 --- a/demo/src/EditorDemo/index.js +++ b/demo/src/EditorDemo/index.js @@ -437,7 +437,7 @@ updateEditor(store, "DemoEditor", { })} {renderToggle({ isSelect: true, - options: ["DNA", "RNA", "Protein"], + options: ["DNA", "RNA", "Protein", "mixedRnaAndDna"], that: this, label: "Molecule Type:", type: "moleculeType", @@ -504,6 +504,18 @@ certain dna specific tools and annotations are automatically disabled when isPro readOnly: false, sequenceData: { ...exampleSequenceData, isRna: true } }); + } else if (val === "mixedRnaAndDna") { + updateEditor(store, "DemoEditor", { + readOnly: false, + sequenceData: tidyUpSequenceData( + { + ...exampleSequenceData, + sequence: "uuuu" + exampleSequenceData.sequence, + isMixedRnaAndDna: true + }, + {} + ) + }); } else { updateEditor(store, "DemoEditor", { readOnly: false, diff --git a/src/updateEditor.js b/src/updateEditor.js index a4cab2676..7add101ab 100644 --- a/src/updateEditor.js +++ b/src/updateEditor.js @@ -66,7 +66,7 @@ export default function updateEditor( }, annotationVisibility: { caret: true, - sequence: false, + sequence: true, reverseSequence: false, ...annotationVisibility, //we spread this here to allow the user to override this .. if they must! translations: false,