FIX: ensures period-chooser is not losing query params (#10534)

eg repro before:
- visit http://pr-discourse.test/top/weekly?f=foo
- select another period in the period chooser
- f=foo was gone

After this commit it should still be present
This commit is contained in:
Joffrey JAFFEUX
2020-08-26 19:01:08 +02:00
committed by GitHub
parent ff4de97dfd
commit f5eccdd0b8
2 changed files with 33 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import DiscourseURL from "discourse/lib/url";
import selectKit from "helpers/select-kit-helper";
import { acceptance } from "helpers/qunit-helpers";
import MessageBus from "message-bus-client";
@@ -107,3 +109,22 @@ QUnit.test("Live update unread state", async assert => {
"shows the topic read"
);
});
QUnit.test(
"Using period chooser when query params are present",
async assert => {
await visit("/top?f=foo&d=bar");
sandbox.stub(DiscourseURL, "routeTo");
const periodChooser = selectKit(".period-chooser");
await periodChooser.expand();
await periodChooser.selectRowByValue("yearly");
assert.ok(
DiscourseURL.routeTo.calledWith("/top/yearly?f=foo&d=bar"),
"it keeps the query params"
);
}
);