@@ -6,97 +6,103 @@ import Breadcrumb from "../Breadcrumb.vue";
6
6
import BreadcrumbItem from "../BreadcrumbItem.vue" ;
7
7
8
8
describe ( "Breadcrumb" , ( ) => {
9
- it ( "renders default breadcrumb" , ( ) => {
10
- const wrapper = mount ( Breadcrumb , {
11
- slots : {
12
- default : ( ) => [
13
- h ( BreadcrumbItem , null , ( ) => "Home" ) ,
14
- h ( BreadcrumbItem , null , ( ) => "Components" ) ,
15
- h ( BreadcrumbItem , { active : true } , ( ) => "Breadcrumb" ) ,
16
- ] ,
17
- } ,
18
- } ) ;
19
-
20
- expect ( wrapper . find ( "nav.breadcrumb" ) . exists ( ) ) . toBe ( true ) ;
21
- expect ( wrapper . findAll ( "li" ) . length ) . toBe ( 3 ) ;
22
- expect ( wrapper . find ( "li.is-active" ) . exists ( ) ) . toBe ( true ) ;
23
- expect ( wrapper . find ( "li.is-active" ) . text ( ) ) . toBe ( "Breadcrumb" ) ;
9
+ it ( "renders default breadcrumb" , ( ) => {
10
+ const wrapper = mount ( Breadcrumb , {
11
+ slots : {
12
+ default : ( ) => [
13
+ h ( BreadcrumbItem , null , ( ) => "Home" ) ,
14
+ h ( BreadcrumbItem , null , ( ) => "Components" ) ,
15
+ h ( BreadcrumbItem , { active : true } , ( ) => "Breadcrumb" ) ,
16
+ ] ,
17
+ } ,
24
18
} ) ;
25
19
26
- it ( "applies alignment classes" , ( ) => {
27
- const centerWrapper = mount ( Breadcrumb , { props : { alignment : "is-centered" } } ) ;
28
- expect ( centerWrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( "is-centered" ) ;
20
+ expect ( wrapper . find ( "nav.breadcrumb" ) . exists ( ) ) . toBe ( true ) ;
21
+ expect ( wrapper . findAll ( "li" ) . length ) . toBe ( 3 ) ;
22
+ expect ( wrapper . find ( "li.is-active" ) . exists ( ) ) . toBe ( true ) ;
23
+ expect ( wrapper . find ( "li.is-active" ) . text ( ) ) . toBe ( "Breadcrumb" ) ;
24
+ } ) ;
29
25
30
- const rightWrapper = mount ( Breadcrumb , { props : { alignment : "is-right" } } ) ;
31
- expect ( rightWrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( "is-right" ) ;
26
+ it ( "applies alignment classes" , ( ) => {
27
+ const centerWrapper = mount ( Breadcrumb , {
28
+ props : { alignment : "is-centered" } ,
32
29
} ) ;
30
+ expect ( centerWrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain (
31
+ "is-centered" ,
32
+ ) ;
33
33
34
- it ( "applies separator classes" , ( ) => {
35
- const separators = [
36
- "has-arrow-separator" ,
37
- "has-bullet-separator" ,
38
- "has-dot-separator" ,
39
- "has-succeeds-separator" ,
40
- ] ;
41
- for ( const separator of separators ) {
42
- const wrapper = mount ( Breadcrumb , { props : { separator } } ) ;
43
- expect ( wrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( separator ) ;
44
- }
34
+ const rightWrapper = mount ( Breadcrumb , {
35
+ props : { alignment : "is-right" } ,
45
36
} ) ;
37
+ expect ( rightWrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( "is-right" ) ;
38
+ } ) ;
46
39
47
- it ( "applies size classes" , ( ) => {
48
- const sizes = [ "is-small" , "is-medium" , "is-large" ] ;
49
- for ( const size of sizes ) {
50
- const wrapper = mount ( Breadcrumb , { props : { size } } ) ;
51
- expect ( wrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( size ) ;
52
- }
53
- } ) ;
40
+ it ( "applies separator classes" , ( ) => {
41
+ const separators = [
42
+ "has-arrow-separator" ,
43
+ "has-bullet-separator" ,
44
+ "has-dot-separator" ,
45
+ "has-succeeds-separator" ,
46
+ ] ;
47
+ for ( const separator of separators ) {
48
+ const wrapper = mount ( Breadcrumb , { props : { separator } } ) ;
49
+ expect ( wrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( separator ) ;
50
+ }
51
+ } ) ;
52
+
53
+ it ( "applies size classes" , ( ) => {
54
+ const sizes = [ "is-small" , "is-medium" , "is-large" ] ;
55
+ for ( const size of sizes ) {
56
+ const wrapper = mount ( Breadcrumb , { props : { size } } ) ;
57
+ expect ( wrapper . find ( "nav.breadcrumb" ) . classes ( ) ) . toContain ( size ) ;
58
+ }
59
+ } ) ;
54
60
} ) ;
55
61
56
62
describe ( "BreadcrumbItem" , ( ) => {
57
- it ( "renders default item with <a> tag" , ( ) => {
58
- const wrapper = mount ( BreadcrumbItem , {
59
- slots : { default : ( ) => "Link Item" } ,
60
- attrs : { href : "#test" } ,
61
- } ) ;
62
- const item = wrapper . find ( "li" ) ;
63
- const link = item . find ( "a" ) ;
64
- expect ( item . exists ( ) ) . toBe ( true ) ;
65
- expect ( link . exists ( ) ) . toBe ( true ) ;
66
- expect ( link . text ( ) ) . toBe ( "Link Item" ) ;
67
- expect ( link . attributes ( "href" ) ) . toBe ( "#test" ) ;
68
- expect ( item . classes ( ) ) . not . toContain ( "is-active" ) ;
63
+ it ( "renders default item with <a> tag" , ( ) => {
64
+ const wrapper = mount ( BreadcrumbItem , {
65
+ slots : { default : ( ) => "Link Item" } ,
66
+ attrs : { href : "#test" } ,
69
67
} ) ;
68
+ const item = wrapper . find ( "li" ) ;
69
+ const link = item . find ( "a" ) ;
70
+ expect ( item . exists ( ) ) . toBe ( true ) ;
71
+ expect ( link . exists ( ) ) . toBe ( true ) ;
72
+ expect ( link . text ( ) ) . toBe ( "Link Item" ) ;
73
+ expect ( link . attributes ( "href" ) ) . toBe ( "#test" ) ;
74
+ expect ( item . classes ( ) ) . not . toContain ( "is-active" ) ;
75
+ } ) ;
70
76
71
- it ( "renders item with custom tag" , ( ) => {
72
- const wrapper = mount ( BreadcrumbItem , {
73
- props : { tag : "span" } ,
74
- slots : { default : ( ) => "Span Item" } ,
75
- } ) ;
76
- const item = wrapper . find ( "li" ) ;
77
- expect ( item . find ( "span" ) . exists ( ) ) . toBe ( true ) ;
78
- expect ( item . find ( "span" ) . text ( ) ) . toBe ( "Span Item" ) ;
77
+ it ( "renders item with custom tag" , ( ) => {
78
+ const wrapper = mount ( BreadcrumbItem , {
79
+ props : { tag : "span" } ,
80
+ slots : { default : ( ) => "Span Item" } ,
79
81
} ) ;
82
+ const item = wrapper . find ( "li" ) ;
83
+ expect ( item . find ( "span" ) . exists ( ) ) . toBe ( true ) ;
84
+ expect ( item . find ( "span" ) . text ( ) ) . toBe ( "Span Item" ) ;
85
+ } ) ;
80
86
81
- it ( "renders active item" , ( ) => {
82
- const wrapper = mount ( BreadcrumbItem , {
83
- props : { active : true } ,
84
- slots : { default : ( ) => "Active Item" } ,
85
- } ) ;
86
- const item = wrapper . find ( "li" ) ;
87
- expect ( item . classes ( ) ) . toContain ( "is-active" ) ;
88
- expect ( item . find ( "a" ) . exists ( ) ) . toBe ( true ) ;
89
- expect ( item . text ( ) ) . toBe ( "Active Item" ) ;
87
+ it ( "renders active item" , ( ) => {
88
+ const wrapper = mount ( BreadcrumbItem , {
89
+ props : { active : true } ,
90
+ slots : { default : ( ) => "Active Item" } ,
90
91
} ) ;
92
+ const item = wrapper . find ( "li" ) ;
93
+ expect ( item . classes ( ) ) . toContain ( "is-active" ) ;
94
+ expect ( item . find ( "a" ) . exists ( ) ) . toBe ( true ) ;
95
+ expect ( item . text ( ) ) . toBe ( "Active Item" ) ;
96
+ } ) ;
91
97
92
- it ( "renders active item with custom tag" , ( ) => {
93
- const wrapper = mount ( BreadcrumbItem , {
94
- props : { active : true , tag : "p" } ,
95
- slots : { default : ( ) => "Active Paragraph" } ,
96
- } ) ;
97
- const item = wrapper . find ( "li" ) ;
98
- expect ( item . classes ( ) ) . toContain ( "is-active" ) ;
99
- expect ( item . find ( "p" ) . exists ( ) ) . toBe ( true ) ;
100
- expect ( item . find ( "p" ) . text ( ) ) . toBe ( "Active Paragraph" ) ;
98
+ it ( "renders active item with custom tag" , ( ) => {
99
+ const wrapper = mount ( BreadcrumbItem , {
100
+ props : { active : true , tag : "p" } ,
101
+ slots : { default : ( ) => "Active Paragraph" } ,
101
102
} ) ;
102
- } ) ;
103
+ const item = wrapper . find ( "li" ) ;
104
+ expect ( item . classes ( ) ) . toContain ( "is-active" ) ;
105
+ expect ( item . find ( "p" ) . exists ( ) ) . toBe ( true ) ;
106
+ expect ( item . find ( "p" ) . text ( ) ) . toBe ( "Active Paragraph" ) ;
107
+ } ) ;
108
+ } ) ;
0 commit comments