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
2021-11-08 10:26:28 +01:00

24 lines
655 B
JavaScript

import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import hbs from "htmlbars-inline-precompile";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
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.strictEqual(
queryAll("span.top-span").text(),
"TOP",
"it inserted the template"
);
});
});