Skip to content
Snippets Groups Projects
Commit 1f0de635 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas :palm_tree:
Browse files

Merge branch 'marina.mosti-3017-checkbox-checked-vue3' into 'main'

fix: vue 3 checked state on GlFormCheckbox

See merge request !4863



Merged-by: Jose Ivan Vargas's avatarJose Ivan Vargas <jvargas@gitlab.com>
Approved-by: Mark Florian's avatarMark Florian <mflorian@gitlab.com>
Approved-by: Jose Ivan Vargas's avatarJose Ivan Vargas <jvargas@gitlab.com>
Approved-by: default avatarDan MH <dmizzi-harris@gitlab.com>
Reviewed-by: Mark Florian's avatarMark Florian <mflorian@gitlab.com>
Co-authored-by: default avatarMarina Mosti <mmosti@gitlab.com>
parents 4cb4d780 eb28dd37
No related branches found
No related tags found
1 merge request!4863fix: vue 3 checked state on GlFormCheckbox
Pipeline #1575614733 passed with warnings
import { mount } from '@vue/test-utils';
import GlFormCheckbox from './form_checkbox.vue';
describe('GlFormCheckbox', () => {
let wrapper;
const createComponent = (options) => {
wrapper = mount(GlFormCheckbox, options);
};
it('can start checked', async () => {
createComponent({
propsData: {
checked: 'checked_value',
value: 'checked_value',
name: 'foo',
},
});
expect(wrapper.find('input[name="foo"]').element.checked).toBe(true);
});
});
......@@ -46,6 +46,18 @@ const Template = (args, { argTypes }) => ({
export const Default = Template.bind({});
const Single = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components,
template: `
<div>
<gl-form-checkbox value="checked-option" checked="checked-option">Checked option</gl-form-checkbox>
</div>
`,
});
export const SingleCheckbox = Single.bind({});
export default {
title: 'base/form/form checkbox',
component: GlFormCheckbox,
......
......@@ -192,7 +192,6 @@ export const formRadioCheckMixin = extend({
const $input = h('input', {
class: ['custom-control-input', this.stateClass],
directives: [{ name: 'model', value: this.computedLocalChecked }],
attrs: this.computedAttrs,
domProps: {
value: this.value,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment