From e1b5cf9a9a149434aad8d10a254c333c38f5f63f Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Thu, 13 Jun 2024 17:51:33 +0300 Subject: [PATCH] Make it possible to cancel "Approximate by ratios" ref #683 --- cypress/e2e/basic.cy.ts | 2 +- src/components/ModifyScale.vue | 2 +- .../modals/modification/ApproximateByRatios.vue | 10 ++++++++-- src/stores/approximate-by-ratios.ts | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/basic.cy.ts b/cypress/e2e/basic.cy.ts index c7016060..98e369c1 100644 --- a/cypress/e2e/basic.cy.ts +++ b/cypress/e2e/basic.cy.ts @@ -49,7 +49,7 @@ describe("Scale generation/modification", () => { for (let i = 0; i < 5; ++i) { cy.get("button").contains("Apply").click(); } - cy.get("button").contains("Close").click(); + cy.get("button").contains("Done").click(); cy.get("#scale-data").should("contain.value", "8/7"); }); }); \ No newline at end of file diff --git a/src/components/ModifyScale.vue b/src/components/ModifyScale.vue index 1d76350e..feaba26d 100644 --- a/src/components/ModifyScale.vue +++ b/src/components/ModifyScale.vue @@ -141,7 +141,7 @@ function clickSubset() { } function clickApproximateByRatios() { - approx.initialize() + approx.initialize(scale.sourceText) showApproximateByRatiosModal.value = true } diff --git a/src/components/modals/modification/ApproximateByRatios.vue b/src/components/modals/modification/ApproximateByRatios.vue index 5f9cec86..901f31cc 100644 --- a/src/components/modals/modification/ApproximateByRatios.vue +++ b/src/components/modals/modification/ApproximateByRatios.vue @@ -121,10 +121,15 @@ function modify(expand = true) { scale.computeScale() emit('done') } + +function cancel() { + scale.sourceText = approx.originalSource + emit('done') +}