Files
David Taylor b3015f51ca DEV: Sort imports
Automatically generated by `eslint --fix` to satisfy the updated configuration
2023-10-10 21:46:54 +01:00

36 lines
1.0 KiB
JavaScript

import { click, render, triggerKeyEvent } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | flat-button", function (hooks) {
setupRenderingTest(hooks);
test("press Enter", async function (assert) {
this.set("foo", null);
this.set("action", () => {
this.set("foo", "bar");
});
await render(hbs`<FlatButton @action={{this.action}} />`);
await triggerKeyEvent(".btn-flat", "keydown", "Space");
assert.strictEqual(this.foo, null);
await triggerKeyEvent(".btn-flat", "keydown", "Enter");
assert.strictEqual(this.foo, "bar");
});
test("click", async function (assert) {
this.set("foo", null);
this.set("action", () => {
this.set("foo", "bar");
});
await render(hbs`<FlatButton @action={{this.action}} />`);
await click(".btn-flat");
assert.strictEqual(this.foo, "bar");
});
});