11import { mountFormGenerator , generatePropsSingleField , generateSchemaSingleField } from '@test/_resources/utils.js'
22import { mount , config } from '@vue/test-utils'
3- import { describe , it , expect } from 'vitest'
3+ import { describe , it , expect , beforeAll } from 'vitest'
44
55import FieldColor from '@/fields/core/FieldColor.vue'
66
@@ -16,6 +16,10 @@ const form = generateSchemaSingleField(
1616
1717const props = generatePropsSingleField ( form )
1818
19+ beforeAll ( ( ) => {
20+ config . global . components = { FieldColor }
21+ } )
22+
1923describe ( 'FieldColor' , ( ) => {
2024
2125 it ( 'Should render correctly' , async ( ) => {
@@ -24,16 +28,12 @@ describe('FieldColor', () => {
2428 } )
2529
2630 it ( 'Should render correctly inside form generator' , async ( ) => {
27- config . global . components = { FieldColor }
28-
2931 const formWrapper = mountFormGenerator ( form . schema , form . model )
3032 expect ( formWrapper . findComponent ( FieldColor ) . exists ( ) ) . toBe ( true )
3133 expect ( formWrapper . find ( 'input[type=color]' ) . exists ( ) ) . toBe ( true )
3234 } )
3335
3436 it ( 'Should render correctly, with input' , async ( ) => {
35- config . global . components = { FieldColor }
36-
3737 const schema = { ...form . schema }
3838 schema . fields [ 0 ] . withInput = true
3939 const formWrapper = mountFormGenerator ( schema , form . model )
@@ -50,8 +50,6 @@ describe('FieldColor', () => {
5050 } )
5151
5252 it ( 'Should update model value' , async ( ) => {
53- config . global . components = { FieldColor }
54-
5553 const formWrapper = mountFormGenerator ( form . schema , form . model )
5654
5755 const wrapper = formWrapper . findComponent ( FieldColor )
@@ -61,8 +59,6 @@ describe('FieldColor', () => {
6159 } )
6260
6361 it ( 'Should update model value and sync values' , async ( ) => {
64- config . global . components = { FieldColor }
65-
6662 const schema = { ...form . schema }
6763 schema . fields [ 0 ] . withInput = true
6864 const formWrapper = mountFormGenerator ( schema , form . model )
0 commit comments