2015-04-07 02:14:00 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2020-03-06 09:33:25 +08:00
|
|
|
import pretender from "helpers/create-pretender";
|
2015-04-07 02:14:00 +08:00
|
|
|
acceptance("Unknown");
|
2014-04-30 03:29:01 +08:00
|
|
|
|
2020-03-06 09:33:25 +08:00
|
|
|
QUnit.test("Permalink Unknown URL", async (assert) => {
|
2018-07-19 22:40:12 +08:00
|
|
|
await visit("/url-that-doesn't-exist");
|
|
|
|
assert.ok(exists(".page-not-found"), "The not found content is present");
|
2014-04-30 03:29:01 +08:00
|
|
|
});
|
2020-03-06 09:33:25 +08:00
|
|
|
|
|
|
|
QUnit.test("Permalink URL to a Topic", async (assert) => {
|
|
|
|
pretender.get("/permalink-check.json", () => {
|
|
|
|
return [
|
|
|
|
200,
|
|
|
|
{ "Content-Type": "application/json" },
|
|
|
|
{
|
|
|
|
found: true,
|
|
|
|
internal: true,
|
|
|
|
target_url: "/t/internationalization-localization/280",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
await visit("/viewtopic.php?f=8&t=280");
|
|
|
|
assert.ok(exists(".topic-post"));
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("Permalink URL to a static page", async (assert) => {
|
|
|
|
pretender.get("/permalink-check.json", () => {
|
|
|
|
return [
|
|
|
|
200,
|
|
|
|
{ "Content-Type": "application/json" },
|
|
|
|
{
|
|
|
|
found: true,
|
|
|
|
internal: true,
|
|
|
|
target_url: "/faq",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
await visit("/not-the-url-for-faq");
|
|
|
|
|
|
|
|
// body is outside of #ember-testing-container and needs to be targeted
|
|
|
|
// through document instead of find
|
|
|
|
assert.ok(
|
|
|
|
document.querySelector("body.static-faq"),
|
|
|
|
"routed to the faq page"
|
|
|
|
);
|
|
|
|
assert.ok(exists(".body-page"));
|
|
|
|
});
|