summaryrefslogtreecommitdiffstats
path: root/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js')
-rw-r--r--devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js b/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
new file mode 100644
index 000000000..240b6d5a1
--- /dev/null
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
@@ -0,0 +1,43 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that the graph's scale and position is reset on a page reload.
+ */
+
+add_task(function* () {
+ let { target, panel } = yield initWebAudioEditor(SIMPLE_CONTEXT_URL);
+ let { panelWin } = panel;
+ let { gFront, $, $$, EVENTS, ContextView } = panelWin;
+
+ let started = once(gFront, "start-context");
+
+ yield Promise.all([
+ waitForGraphRendered(panelWin, 3, 2),
+ reload(target),
+ ]);
+
+ is(ContextView.getCurrentScale(), 1, "Default graph scale is 1.");
+ is(ContextView.getCurrentTranslation()[0], 20, "Default x-translation is 20.");
+ is(ContextView.getCurrentTranslation()[1], 20, "Default y-translation is 20.");
+
+ // Change both attribute and D3's internal store
+ panelWin.d3.select("#graph-target").attr("transform", "translate([100, 400]) scale(10)");
+ ContextView._zoomBinding.scale(10);
+ ContextView._zoomBinding.translate([100, 400]);
+
+ is(ContextView.getCurrentScale(), 10, "After zoom, scale is 10.");
+ is(ContextView.getCurrentTranslation()[0], 100, "After zoom, x-translation is 100.");
+ is(ContextView.getCurrentTranslation()[1], 400, "After zoom, y-translation is 400.");
+
+ yield Promise.all([
+ waitForGraphRendered(panelWin, 3, 2),
+ reload(target),
+ ]);
+
+ is(ContextView.getCurrentScale(), 1, "After refresh, graph scale is 1.");
+ is(ContextView.getCurrentTranslation()[0], 20, "After refresh, x-translation is 20.");
+ is(ContextView.getCurrentTranslation()[1], 20, "After refresh, y-translation is 20.");
+
+ yield teardown(target);
+});