mirror of
https://github.com/discourse/discourse.git
synced 2025-01-20 05:52:46 +08:00
176aa0ac7d
* DEV: Remove server global test variable * Delete yarn-error.log * prettier and some eslint fixes * add global server variable back for plugins * rename imported server to pretender * prettier * support plugin server. usage * Export pretender as named * Prettier * change default pretender export * fix bad import * Use pretender() and original default export * export new Pretender as default * fix accidental change * WIP testing * add pretend handlers in correct location * move more stuff into the correct pretender * Consolidated more pretenders * comment out another bad test * fix user acceptance tests * commented out bad test * fixed another composer server stub * fix more tests * fixed tag test pretender * Fix admin email test * removed another draft handler * add back test * fix and uncomment another test * remove test that is not useful * remove commented out lines * reapply handlers between every test * no need to re-stub requests now :) * cleanup from review * more cleanup
65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
import { acceptance } from "helpers/qunit-helpers";
|
|
import pretender from "helpers/create-pretender";
|
|
|
|
acceptance("Keyboard Shortcuts", { loggedIn: true });
|
|
|
|
test("go to first suggested topic", async assert => {
|
|
pretender.get("/t/27331/4.json", () => [
|
|
200,
|
|
{ "Content-Type": "application/json" },
|
|
{}
|
|
]);
|
|
|
|
pretender.get("/t/27331.json", () => [
|
|
200,
|
|
{ "Content-Type": "application/json" },
|
|
{}
|
|
]);
|
|
|
|
/*
|
|
* No suggested topics exist.
|
|
*/
|
|
|
|
pretender.get("/t/9/last.json", () => [
|
|
200,
|
|
{ "Content-Type": "application/json" },
|
|
{}
|
|
]);
|
|
|
|
await visit("/t/this-is-a-test-topic/9");
|
|
await keyEvent(document, "keypress", "g".charCodeAt(0));
|
|
await keyEvent(document, "keypress", "s".charCodeAt(0));
|
|
assert.equal(currentURL(), "/t/this-is-a-test-topic/9");
|
|
|
|
/*
|
|
* Suggested topics elements exist.
|
|
*/
|
|
|
|
await visit("/t/internationalization-localization/280");
|
|
await keyEvent(document, "keypress", "g".charCodeAt(0));
|
|
await keyEvent(document, "keypress", "s".charCodeAt(0));
|
|
assert.equal(currentURL(), "/t/polls-are-still-very-buggy/27331/4");
|
|
|
|
/*
|
|
* Suggested topic is returned by server.
|
|
*/
|
|
|
|
pretender.get("/t/28830/last.json", () => [
|
|
200,
|
|
{ "Content-Type": "application/json" },
|
|
{
|
|
suggested_topics: [
|
|
{
|
|
id: 27331,
|
|
slug: "keyboard-shortcuts-are-awesome"
|
|
}
|
|
]
|
|
}
|
|
]);
|
|
|
|
await visit("/t/1-3-0beta9-no-rate-limit-popups/28830");
|
|
await keyEvent(document, "keypress", "g".charCodeAt(0));
|
|
await keyEvent(document, "keypress", "s".charCodeAt(0));
|
|
assert.equal(currentURL(), "/t/keyboard-shortcuts-are-awesome/27331");
|
|
});
|