mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
parent
322db8adb5
commit
67c3f29486
@ -1,6 +0,0 @@
|
|||||||
{{#unless this.expanded}}
|
|
||||||
<DButton @action={{this.expand}} @label={{this.label}} class="btn-link" />
|
|
||||||
{{/unless}}
|
|
||||||
{{#if this.expanded}}
|
|
||||||
<span class="description" aria-live="assertive">{{this.details}}</span>
|
|
||||||
{{/if}}
|
|
@ -1,9 +0,0 @@
|
|||||||
import Component from "@ember/component";
|
|
||||||
import { action } from "@ember/object";
|
|
||||||
|
|
||||||
export default Component.extend({
|
|
||||||
@action
|
|
||||||
expand() {
|
|
||||||
this.set("expanded", true);
|
|
||||||
},
|
|
||||||
});
|
|
@ -1,29 +0,0 @@
|
|||||||
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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
|
||||||
import I18n from "discourse-i18n";
|
|
||||||
|
|
||||||
module("Integration | Component | hidden-details", function (hooks) {
|
|
||||||
setupRenderingTest(hooks);
|
|
||||||
|
|
||||||
test("Shows a link and turns link into details on click", async function (assert) {
|
|
||||||
this.set("label", "label");
|
|
||||||
this.set("details", "details");
|
|
||||||
|
|
||||||
await render(
|
|
||||||
hbs`<HiddenDetails @label={{this.label}} @details={{this.details}} />`
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.ok(exists(".btn-link"));
|
|
||||||
assert.strictEqual(query(".btn-link span").innerText, I18n.t("label"));
|
|
||||||
assert.notOk(exists(".description"));
|
|
||||||
|
|
||||||
await click(".btn-link");
|
|
||||||
|
|
||||||
assert.notOk(exists(".btn-link"));
|
|
||||||
assert.ok(exists(".description"));
|
|
||||||
assert.strictEqual(query(".description").innerText, "details");
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user