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
Robin Ward dab2f2fdf4 REFACTOR: We can't use Ember.HTMLBars.compile in Ember CLI
Instead we use the inline `hbs` helper. Note in the non-Ember CLI
version this will not actually inline compile, but it will still work
for all our tests.
2020-11-26 09:27:20 -05:00

25 lines
731 B
JavaScript

import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
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"
);
});
});