Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit 74e1215

Browse files
fix: fixed radio button issue
1 parent ce71c60 commit 74e1215

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

src/components/Form/Controls/InputMixin.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@ export default {
1818
plain: $default(false)
1919
},
2020
computed: {
21-
inputStateClasses() {
22-
const { state } = this;
23-
return { [`is-${state}`]: state != null };
24-
},
2521
inputClasses() {
2622
return {
2723
"fd-form__control": !this.plain,
2824
"fd-input--compact": this.finalCompact,
29-
...this.inputStateClasses,
30-
"is-required": this.required
25+
"is-required": this.required,
26+
"is-valid": this.state === "valid",
27+
"is-invalid": this.state === "invalid",
28+
"is-warning": this.state === "warning"
3129
};
3230
},
3331
inputId() {

src/components/Form/Controls/Radio.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
:disabled="disabled ? '' : null"
66
:checked="checked ? true : false"
77
:value="value"
8-
@input="$emit('update', $event.target.value, $event)"
8+
@change="$emit('update', $event.target.value, $event)"
99
v-on="$listeners"
1010
v-bind="$attrs"
11+
:id="inputId"
1112
/>
1213
</template>
1314

1415
<script>
15-
// :id="inputId"
1616
import InputMixin from "./InputMixin";
1717
import { $valueWithDefault, $modelValueWithDefault } from "./Helper/prop";
1818

src/components/Form/Controls/Select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
@change="$emit('update', $event.target.value)"
88
v-on="$listeners"
99
v-bind="$attrs"
10+
:id="inputId"
1011
>
1112
<slot />
1213
</select>
1314
</template>
1415

1516
<script>
16-
// :id="inputId"
1717
import InputMixin from "./InputMixin";
1818
import { $valueWithDefault } from "./Helper/prop";
1919

src/components/Form/Controls/Toggle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:value="value"
88
:disabled="disabled"
99
@update="$emit('update', $event)"
10-
></FdCheckbox>
10+
/>
1111
<span class="fd-toggle__switch" role="presentation" />
1212
</span>
1313
</template>

src/components/Form/Controls/__tests__/Checkbox.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("FormItem", () => {
4141
expect(radio.isVisible()).toBe(true);
4242

4343
radio.element.value = "helloWorld";
44-
radio.trigger("input");
44+
radio.trigger("change");
4545
await localVue.nextTick();
4646
expect(form.vm.checked).toBe("helloWorld");
4747
});

0 commit comments

Comments
 (0)