File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ import { mount } from '@vue/test-utils' ;
2+ import { expect , test } from 'vitest' ;
3+ import TextFieldtype from '@/components/fieldtypes/TextFieldtype.vue' ;
4+ import TextInput from '@/components/inputs/Text.vue' ;
5+
6+ test ( 'sets mode' , async ( ) => {
7+ const wrapper = mount ( TextFieldtype , {
8+ props : {
9+ value : null ,
10+ handle : 'name' ,
11+ } ,
12+ components : {
13+ TextInput,
14+ } ,
15+ } ) ;
16+
17+ const input = wrapper . find ( 'input' ) ;
18+ expect ( input . element . value ) . toBe ( '' ) ;
19+ expect ( wrapper . emitted ( 'update:value' ) ) . toBeUndefined ( ) ;
20+
21+ await input . setValue ( 'John' ) ;
22+ expect ( input . element . value ) . toBe ( 'John' ) ;
23+ expect ( wrapper . emitted ( 'update:value' ) [ 0 ] ) . toEqual ( [ 'John' ] ) ;
24+ } ) ;
Original file line number Diff line number Diff line change 1+ import { config } from '@vue/test-utils' ;
2+
3+ config . global . directives = {
4+ tooltip : ( ) => { } ,
5+ } ;
6+
7+ config . global . mocks = {
8+ __ : ( key ) => key ,
9+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import laravel from 'laravel-vite-plugin';
33import vue from '@vitejs/plugin-vue' ;
44import inject from '@rollup/plugin-inject' ;
55import svgLoader from 'vite-svg-loader' ;
6+ import path from 'path' ;
67
78export default defineConfig ( ( { mode } ) => {
89 const env = loadEnv ( mode , process . cwd ( ) , '' ) ;
@@ -28,13 +29,15 @@ export default defineConfig(({ mode }) => {
2829 resolve : {
2930 alias : {
3031 vue : 'vue/dist/vue.esm-bundler.js' ,
32+ '@' : path . resolve ( __dirname , 'resources/js' ) ,
3133 } ,
3234 } ,
3335 optimizeDeps : {
3436 include : [ 'vue' ] ,
3537 } ,
3638 test : {
3739 environment : 'jsdom' ,
40+ setupFiles : 'resources/js/tests/setup.js' ,
3841 } ,
3942 } ;
4043} ) ;
You can’t perform that action at this time.
0 commit comments