FEATURE: Add Data Explorer Params to the URL on run (#128)

Co-authored-by: Mark VanLandingham <[email protected]>
This commit is contained in:
Guhyoun Nam
2021-09-14 10:10:16 -05:00
committed by GitHub
co-authored by Mark VanLandingham
parent 0c9005513a
commit 286b5b5fe7
4 changed files with 40 additions and 4 deletions
@@ -4,6 +4,7 @@ import {
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import I18n from "I18n";
@@ -188,4 +189,15 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {
assert.ok(exists("canvas"), "the chart was rendered");
});
test("it puts params for the query into the url", async function (assert) {
await visit("admin/plugins/explorer?id=-6");
const monthsAgoValue = "2";
await fillIn(".query-params input", monthsAgoValue);
await click("form.query-run button");
let searchParams = new URLSearchParams(currentURL());
let paramsMonthsAgo = JSON.parse(searchParams.get("params")).months_ago;
assert.equal(paramsMonthsAgo, monthsAgoValue);
});
});