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:
Joffrey JAFFEUX 2024-11-04 17:57:40 +09:00 committed by GitHub
parent 88eb96b315
commit 584a9d98ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -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}}

View File

@ -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|>