DEV: Remove `isLegacyEmber` (#100)
This commit is contained in:
parent
4e950617b7
commit
632042981f
|
@ -1,14 +1,11 @@
|
||||||
|
import { test } from "qunit";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
import { click, currentURL, visit } from "@ember/test-helpers";
|
import { click, currentURL, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
conditionalTest,
|
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { isLegacyEmber } from "discourse-common/config/environment";
|
|
||||||
import docsFixtures from "../fixtures/docs";
|
import docsFixtures from "../fixtures/docs";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
|
||||||
|
@ -19,18 +16,14 @@ acceptance("Docs - Sidebar with docs disabled", function (needs) {
|
||||||
docs_enabled: false,
|
docs_enabled: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
conditionalTest(
|
test("docs sidebar link is hidden", async function (assert) {
|
||||||
"docs sidebar link is hidden",
|
await visit("/");
|
||||||
!isLegacyEmber(),
|
|
||||||
async function (assert) {
|
|
||||||
await visit("/");
|
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!exists(".sidebar-section-link-docs"),
|
!exists(".sidebar-section-link-docs"),
|
||||||
"it does not display the docs link in sidebar"
|
"it does not display the docs link in sidebar"
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptance("Docs - Sidebar with docs enabled", function (needs) {
|
acceptance("Docs - Sidebar with docs enabled", function (needs) {
|
||||||
|
@ -43,31 +36,23 @@ acceptance("Docs - Sidebar with docs enabled", function (needs) {
|
||||||
server.get("/docs.json", () => helper.response(cloneJSON(docsFixtures)));
|
server.get("/docs.json", () => helper.response(cloneJSON(docsFixtures)));
|
||||||
});
|
});
|
||||||
|
|
||||||
conditionalTest(
|
test("clicking on docs link", async function (assert) {
|
||||||
"clicking on docs link",
|
await visit("/");
|
||||||
!isLegacyEmber(),
|
|
||||||
async function (assert) {
|
|
||||||
await visit("/");
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".sidebar-section-link-docs").textContent.trim(),
|
query(".sidebar-section-link-docs").textContent.trim(),
|
||||||
I18n.t("sidebar.docs_link_text"),
|
I18n.t("sidebar.docs_link_text"),
|
||||||
"displays the right text for the link"
|
"displays the right text for the link"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".sidebar-section-link-docs").title,
|
query(".sidebar-section-link-docs").title,
|
||||||
I18n.t("sidebar.docs_link_title"),
|
I18n.t("sidebar.docs_link_title"),
|
||||||
"displays the right title for the link"
|
"displays the right title for the link"
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(".sidebar-section-link-docs");
|
await click(".sidebar-section-link-docs");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(currentURL(), "/docs", "it navigates to the right page");
|
||||||
currentURL(),
|
});
|
||||||
"/docs",
|
|
||||||
"it navigates to the right page"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue