mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
DEV: [gjs-codemod] Convert automation/styleguide/other to gjs
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { click, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-boolean-field", function (hooks) {
|
||||
@ -13,10 +13,17 @@ module("Integration | Component | da-boolean-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field();
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await click("input");
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-categories-field", function (hooks) {
|
||||
@ -14,12 +14,19 @@ module("Integration | Component | da-categories-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("sets values", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "categories",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-category-field", function (hooks) {
|
||||
@ -14,12 +14,19 @@ module("Integration | Component | da-category-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "category",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import notificationsTracking from "discourse/tests/helpers/notifications-tracking-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module(
|
||||
@ -16,12 +16,19 @@ module(
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "category_notification_level",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await notificationsTracking().selectLevelId(2);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-choices-field", function (hooks) {
|
||||
@ -14,13 +14,20 @@ module("Integration | Component | da-choices-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "choices",
|
||||
extra: { content: [{ name: "One", id: 1 }] },
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs` <AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-custom-field", function (hooks) {
|
||||
@ -34,12 +34,19 @@ module("Integration | Component | da-custom-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "custom_field",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-date-time-field", function (hooks) {
|
||||
@ -13,12 +13,19 @@ module("Integration | Component | da-date-time-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "date_time",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await fillIn("input", "2023-10-03T12:34");
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import DaEmailGroupUserField from "discourse/plugins/automation/admin/components/fields/da-email-group-user-field";
|
||||
|
||||
module("Integration | Component | email-group-user-field", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test("Email group user field uses email-group-user-chooser component", async function (assert) {
|
||||
const template = hbs` <Fields::DaEmailGroupUserField @label="a label" />`;
|
||||
const template = <template>
|
||||
<DaEmailGroupUserField @label="a label" />
|
||||
</template>;
|
||||
|
||||
await render(template);
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-group-field", function (hooks) {
|
||||
@ -27,12 +27,19 @@ module("Integration | Component | da-group-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "group",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-groups-field", function (hooks) {
|
||||
@ -34,12 +34,19 @@ module("Integration | Component | da-groups-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "groups",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
@ -49,13 +56,20 @@ module("Integration | Component | da-groups-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("supports a maxmimum value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "groups",
|
||||
extra: { maximum: 1 },
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-message-field", function (hooks) {
|
||||
@ -13,12 +13,19 @@ module("Integration | Component | da-message-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "message",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await fillIn("textarea", "Hello World");
|
||||
|
||||
@ -26,13 +33,20 @@ module("Integration | Component | da-message-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("render placeholders", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "message",
|
||||
});
|
||||
this.automation.placeholders = ["foo", "bar"];
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
assert.dom(".placeholders-list").hasText("foo bar");
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { click, fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-pms-field", function (hooks) {
|
||||
@ -13,12 +13,19 @@ module("Integration | Component | da-pms-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "pms",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await click(".insert-pm");
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-post-field", function (hooks) {
|
||||
@ -13,12 +13,19 @@ module("Integration | Component | da-post-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "post",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await fillIn("textarea", "Hello World");
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-tags-field", function (hooks) {
|
||||
@ -14,12 +14,19 @@ module("Integration | Component | da-tags-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "tags",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-text-field", function (hooks) {
|
||||
@ -13,12 +13,19 @@ module("Integration | Component | da-text-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "text",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await fillIn("input", "Hello World");
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-text-list-field", function (hooks) {
|
||||
@ -14,12 +14,19 @@ module("Integration | Component | da-text-list-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "text_list",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
await selectKit().expand();
|
||||
await selectKit().fillInFilter("test");
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-trust-levels-field", function (hooks) {
|
||||
@ -14,12 +14,19 @@ module("Integration | Component | da-trust-levels-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "trust-levels",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-user-field", function (hooks) {
|
||||
@ -27,12 +27,19 @@ module("Integration | Component | da-user-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("set value", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "user",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
|
||||
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
|
||||
|
||||
module("Integration | Component | da-users-field", function (hooks) {
|
||||
@ -32,12 +32,19 @@ module("Integration | Component | da-users-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("sets values", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "users",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
@ -50,12 +57,19 @@ module("Integration | Component | da-users-field", function (hooks) {
|
||||
});
|
||||
|
||||
test("allows emails", async function (assert) {
|
||||
const self = this;
|
||||
|
||||
this.field = new AutomationFabricators(getOwner(this)).field({
|
||||
component: "users",
|
||||
});
|
||||
|
||||
await render(
|
||||
hbs`<AutomationField @automation={{this.automation}} @field={{this.field}} />`
|
||||
<template>
|
||||
<AutomationField
|
||||
@automation={{self.automation}}
|
||||
@field={{self.field}}
|
||||
/>
|
||||
</template>
|
||||
);
|
||||
|
||||
await selectKit().expand();
|
||||
|
Reference in New Issue
Block a user