Files
David TaylorandGitHub e66e8d0035 FIX: Further improvements to // handling (#28211)
Followup to 5eeb3623a9

1. Update a second regex in `routeTo` to avoid stripping domain/protocol from middle of string

2. Update `URL.handleURL` to strip double-slashes in paths, before calling the ember router. This mimics what Ember does on initial page-load

Additional tests are added for both
2024-08-02 18:11:11 +01:00

20 lines
557 B
JavaScript

import { currentURL, settled, visit } from "@ember/test-helpers";
import { test } from "qunit";
import DiscourseURL from "discourse/lib/url";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("DiscourseURL", function () {
test("handleURL strips multiple slashes", async function (assert) {
await visit("/");
DiscourseURL.handleURL("/t//280");
await settled();
assert.strictEqual(
currentURL(),
"/t/internationalization-localization/280"
);
assert.dom("#topic-title").exists();
});
});