Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions components/form/__tests__/form-911.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { describe, expect, it } from 'vitest';
import { mount } from '@vue/test-utils';
import { h, nextTick } from 'vue';
import FForm from '../form.vue';
import FFormItem from '../formItem.vue';

describe('FForm labelWidth #911', () => {
it('FForm labelWidth propagates to FFormItem', async () => {
const wrapper = mount(FForm, {
props: { labelWidth: '100px' },
slots: {
default: () => [h(FFormItem, { label: 'Name' }, { default: () => 'input' })],
},
});
await nextTick();
const html = wrapper.html();
console.log('HTML:', JSON.stringify(html));
expect(html).toContain('width: 100px');
});

it('FFormItem own labelWidth overrides FForm labelWidth', async () => {
const wrapper = mount(FForm, {
props: { labelWidth: '80px' },
slots: {
default: () => [h(FFormItem, { label: 'Email', labelWidth: '120px' }, { default: () => 'input' })],
},
});
await nextTick();
const html = wrapper.html();
console.log('HTML:', JSON.stringify(html));
expect(html).toContain('width: 120px');
});
});
Loading