This repository was archived by the owner on Aug 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed
ui/src/components/Label/__tests__ Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ import { mount } from "@vue/test-utils" ;
2+ import Label from "../Label.vue" ;
3+
4+ describe ( "Label" , ( ) => {
5+ it ( "renders correctly" , ( ) => {
6+ const wrapper = mount ( Label , {
7+ propsData : {
8+ type : "warning"
9+ } ,
10+ slots : {
11+ default : "Label"
12+ }
13+ } ) ;
14+ expect ( wrapper . element ) . toMatchSnapshot ( ) ;
15+ } ) ;
16+
17+ it ( "renders correct types" , ( ) => {
18+ const labelWarning = mount ( Label , {
19+ propsData : {
20+ type : "warning"
21+ } ,
22+ slots : {
23+ default : "Label"
24+ }
25+ } ) ;
26+ const labelError = mount ( Label , {
27+ propsData : {
28+ type : "error"
29+ } ,
30+ slots : {
31+ default : "Label"
32+ }
33+ } ) ;
34+ const labelSuccess = mount ( Label , {
35+ propsData : {
36+ type : "success"
37+ } ,
38+ slots : {
39+ default : "Label"
40+ }
41+ } ) ;
42+
43+ expect ( labelWarning . classes ( 'fd-label--warning' ) ) . toBe ( true ) ;
44+ expect ( labelError . classes ( 'fd-label--error' ) ) . toBe ( true ) ;
45+ expect ( labelSuccess . classes ( 'fd-label--success' ) ) . toBe ( true ) ;
46+ } ) ;
47+
48+ it ( "renders default slot when passed" , ( ) => {
49+ const label = "Label" ;
50+ const wrapper = mount ( Label , {
51+ slots : {
52+ default : label
53+ }
54+ } ) ;
55+ expect ( wrapper . text ( ) ) . toEqual ( label ) ;
56+ } ) ;
57+ } )
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` Label renders correctly 1` ] = `
4+ <span
5+ class = " fd-label fd-label--warning"
6+ >
7+ Label
8+ </span >
9+ ` ;
You can’t perform that action at this time.
0 commit comments