mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
DEV: adds is-disabled modifier to form field container (#29567)
We already had a data-attribute, but a class feels more natural in this case.
This commit is contained in:
parent
88eb96b315
commit
584a9d98ed
@ -44,6 +44,7 @@ export default class FKControlWrapper extends Component {
|
||||
"form-kit__field"
|
||||
(concat "form-kit__field-" this.controlType)
|
||||
(if this.error "has-error")
|
||||
(if @field.disabled "is-disabled")
|
||||
(if (eq @format "full") "--full")
|
||||
}}
|
||||
data-disabled={{@field.disabled}}
|
||||
|
@ -35,6 +35,20 @@ module("Integration | Component | FormKit | Field", function (hooks) {
|
||||
assert.dom(".form-kit__row .form-kit__col.--col-8").hasText("Test");
|
||||
});
|
||||
|
||||
test("@disabled", async function (assert) {
|
||||
await render(<template>
|
||||
<Form as |form|>
|
||||
<form.Field @name="foo" @title="Foo" @disabled={{true}} as |field|>
|
||||
<field.Input />
|
||||
</form.Field>
|
||||
</Form>
|
||||
</template>);
|
||||
|
||||
assert
|
||||
.dom("#control-foo.is-disabled[data-disabled]")
|
||||
.exists("it sets the disabled class and data attribute");
|
||||
});
|
||||
|
||||
test("@description", async function (assert) {
|
||||
await render(<template>
|
||||
<Form as |form|>
|
||||
|
Loading…
Reference in New Issue
Block a user