This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js
Roman Rizzi 1c2358ba16
DEV: Tidy up imports. (#11364)
Only allow one import definition per file and add a new eslint rule to enforce it.
2020-11-27 11:30:16 -03:00

24 lines
675 B
JavaScript

import { queryAll, acceptance } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import Ember from "ember";
import hbs from "htmlbars-inline-precompile";
acceptance("CustomHTML template", function (needs) {
needs.hooks.beforeEach(() => {
Ember.TEMPLATES["top"] = hbs`<span class='top-span'>TOP</span>`;
});
needs.hooks.afterEach(() => {
delete Ember.TEMPLATES["top"];
});
test("renders custom template", async function (assert) {
await visit("/static/faq");
assert.equal(
queryAll("span.top-span").text(),
"TOP",
"it inserted the template"
);
});
});