import { mount, shallowMount, VueWrapper } from '@vue/test-utils' import { beforeEach, describe, expect, it } from 'vitest' import AmeliproTextArea from '../AmeliproTextArea.vue' import type { ComponentProps } from 'vue-component-type-helpers' import type { ExpectedPropOptions } from '@tests/types' import type { PropType } from 'vue' import TestHelper from '@tests/helpers/TestHelper' import type { ValidateOnType } from '../../types' import type { ValidationRule } from '@/utils/rules/types' const expectedPropOptions: ExpectedPropOptions = { required: { type: Boolean, default: false, }, classes: { type: String, default: undefined, }, counter: { type: Number, default: 255, }, disabled: { type: Boolean, default: false, }, globalMaxWidth: { type: String, default: undefined, }, globalMinWidth: { type: String, default: undefined, }, globalWidth: { type: String, default: undefined, }, horizontal: { type: Boolean, default: false, }, inputMaxWidth: { type: String, default: undefined, }, inputMinWidth: { type: String, default: undefined, }, label: { type: String, required: true, }, labelMaxWidth: { type: String, default: undefined, }, labelMinWidth: { type: String, default: undefined, }, modelValue: { type: String, default: undefined, }, readonly: { type: Boolean, default: false, }, rules: { type: Array as PropType, default: () => [], }, uniqueId: { type: String, required: true, }, validateOn: { default: undefined, type: String as PropType, validator(value: string): boolean { return ['lazy', 'blur', 'input', 'submit', 'blur lazy', 'input lazy', 'submit lazy', 'lazy blur', 'lazy input', 'lazy submit'].includes(value.toLowerCase()) }, }, } const requiredPropValues = (): ComponentProps => ({ label: 'Required label', uniqueId: 'required-unique-id', }) const modifiedPropValues = (): ComponentProps => ({ required: true, classes: 'modified-classes', counter: 100, disabled: true, globalMaxWidth: '300px', globalMinWidth: '100px', globalWidth: '200px', horizontal: true, inputMaxWidth: '150px', inputMinWidth: '50px', label: 'Modified label', labelMaxWidth: '120px', labelMinWidth: '60px', modelValue: 'Modified model value', readonly: true, rules: [() => true], uniqueId: 'modified-unique-id', validateOn: 'input', }) const VTextareaStub = { name: 'VTextarea', inheritAttrs: false, props: ['disabled', 'readonly', 'modelValue'], template: `