File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 "devDependencies" : {
2121 "@rsbuild/plugin-vue" : " ^2.0.1" ,
2222 "@testing-library/jest-dom" : " ^7.0.0" ,
23- "@testing-library/vue" : " ^8.1.0" ,
2423 "@vue/test-utils" : " ^2.4.11" ,
2524 "happy-dom" : " ^20.11.1" ,
2625 "rstack" : " ^0.3.5"
Original file line number Diff line number Diff line change 11import { expect , test } from 'rstack/test' ;
2- import { render , screen } from '@testing-library/ vue' ;
2+ import { mount } from '@vue/test-utils ' ;
33import App from '../src/App.vue' ;
44
55test ( 'renders the main page' , ( ) => {
6- render ( App ) ;
7- expect ( screen . getByText ( 'Rstack with Vue' ) ) . toBeInTheDocument ( ) ;
6+ const wrapper = mount ( App ) ;
7+ expect ( wrapper . element ) . toHaveTextContent ( 'Rstack with Vue' ) ;
88} ) ;
Original file line number Diff line number Diff line change 2020 "devDependencies" : {
2121 "@rsbuild/plugin-vue" : " ^2.0.1" ,
2222 "@testing-library/jest-dom" : " ^7.0.0" ,
23- "@testing-library/vue" : " ^8.1.0" ,
2423 "@types/node" : " ^24.13.3" ,
2524 "@vue/test-utils" : " ^2.4.11" ,
2625 "happy-dom" : " ^20.11.1" ,
Original file line number Diff line number Diff line change 11import { expect , test } from 'rstack/test' ;
2- import { render , screen } from '@testing-library/ vue' ;
2+ import { mount } from '@vue/test-utils ' ;
33import App from '../src/App.vue' ;
44
55test ( 'renders the main page' , ( ) => {
6- render ( App ) ;
7- expect ( screen . getByText ( 'Rstack with Vue' ) ) . toBeInTheDocument ( ) ;
6+ const wrapper = mount ( App ) ;
7+ expect ( wrapper . element ) . toHaveTextContent ( 'Rstack with Vue' ) ;
88} ) ;
Original file line number Diff line number Diff line change 2424 "devDependencies" : {
2525 "@rsbuild/plugin-vue" : " ^2.0.1" ,
2626 "@testing-library/jest-dom" : " ^7.0.0" ,
27- "@testing-library/vue" : " ^8.1.0" ,
2827 "@vue/test-utils" : " ^2.4.11" ,
2928 "happy-dom" : " ^20.11.1" ,
3029 "rstack" : " ^0.3.5" ,
Original file line number Diff line number Diff line change 11import { expect , test } from 'rstack/test' ;
2- import { render , screen } from '@testing-library/ vue' ;
2+ import { mount } from '@vue/test-utils ' ;
33import Button from '../src/Button.vue' ;
44
5- test ( 'The button should have correct background color' , async ( ) => {
6- render ( Button , {
5+ test ( 'The button should have correct background color' , ( ) => {
6+ const wrapper = mount ( Button , {
7+ attachTo : document . body ,
78 props : {
89 backgroundColor : '#ccc' ,
910 label : 'Demo Button' ,
1011 } ,
1112 } ) ;
12- const button = screen . getByText ( 'Demo Button' ) ;
13- expect ( button ) . toHaveStyle ( {
13+ expect ( wrapper . get ( 'button' ) . element ) . toHaveStyle ( {
1414 backgroundColor : '#ccc' ,
1515 } ) ;
16+ wrapper . unmount ( ) ;
1617} ) ;
Original file line number Diff line number Diff line change 2626 "devDependencies" : {
2727 "@rsbuild/plugin-vue" : " ^2.0.1" ,
2828 "@testing-library/jest-dom" : " ^7.0.0" ,
29- "@testing-library/vue" : " ^8.1.0" ,
3029 "@types/node" : " ^24.13.3" ,
3130 "@vue/test-utils" : " ^2.4.11" ,
3231 "happy-dom" : " ^20.11.1" ,
Original file line number Diff line number Diff line change 11import { expect , test } from 'rstack/test' ;
2- import { render , screen } from '@testing-library/ vue' ;
2+ import { mount } from '@vue/test-utils ' ;
33import Button from '../src/Button.vue' ;
44
5- test ( 'The button should have correct background color' , async ( ) => {
6- render ( Button , {
5+ test ( 'The button should have correct background color' , ( ) => {
6+ const wrapper = mount ( Button , {
7+ attachTo : document . body ,
78 props : {
89 backgroundColor : '#ccc' ,
910 label : 'Demo Button' ,
1011 } ,
1112 } ) ;
12- const button = screen . getByText ( 'Demo Button' ) ;
13- expect ( button ) . toHaveStyle ( {
13+ expect ( wrapper . get ( 'button' ) . element ) . toHaveStyle ( {
1414 backgroundColor : '#ccc' ,
1515 } ) ;
16+ wrapper . unmount ( ) ;
1617} ) ;
You can’t perform that action at this time.
0 commit comments