mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: allows fabricators to use faker (#26555)
The complexity of the situation is that we don't want to load faker into production by default but fabricators and styleguide are available on production. This is made possible through app/assets/javascripts/discourse/app/lib/load-faker.js which contains a function to ensure faker is loaded asynchronously (loadFaker) and another function to access the loaded faker (getLoadedFaker). Note 1: this commit also refactors fabricators to have access to context and use faker where possible Note 2: this commit moves automation to admin bundle --------- Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
@ -1,16 +1,17 @@
|
||||
import { getOwner } from "@ember/application";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-thread-header", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test("it safely renders title", async function (assert) {
|
||||
const title = "<style>body { background: red;}</style>";
|
||||
this.thread = fabricators.thread({ title });
|
||||
this.thread = new ChatFabricators(getOwner(this)).thread({ title });
|
||||
|
||||
await render(hbs`
|
||||
<Chat::Thread::Header @thread={{this.thread}} @channel={{this.thread.channel}} />
|
||||
|
Reference in New Issue
Block a user