@@ -52,7 +52,7 @@ describe('breadcrumb-item', () => {
52
52
expect ( $blink . emitted ( ) ) . toHaveProperty ( 'click' )
53
53
} )
54
54
55
- it ( 'does not emit click event when prop disabled' , async ( ) => {
55
+ it ( 'does not emit click event when prop disabled and blink clicked ' , async ( ) => {
56
56
const wrapper = mount ( BBreadcrumbItem , {
57
57
props : { disabled : true } ,
58
58
} )
@@ -61,6 +61,15 @@ describe('breadcrumb-item', () => {
61
61
expect ( wrapper . emitted ( 'click' ) ) . toBeUndefined ( )
62
62
} )
63
63
64
+ it ( 'does not emit click event when prop active and span clicked' , async ( ) => {
65
+ const wrapper = mount ( BBreadcrumbItem , {
66
+ props : { active : true } ,
67
+ } )
68
+ const $span = wrapper . get ( 'span' )
69
+ await $span . trigger ( 'click' )
70
+ expect ( wrapper . emitted ( 'click' ) ) . toBeUndefined ( )
71
+ } )
72
+
64
73
it ( 'emits a MouseEvent when clicked' , async ( ) => {
65
74
const wrapper = mount ( BBreadcrumbItem )
66
75
const $blink = wrapper . getComponent ( BLink )
@@ -77,4 +86,93 @@ describe('breadcrumb-item', () => {
77
86
const $span = wrapper . get ( 'span' )
78
87
expect ( $span . text ( ) ) . toBe ( 'foobar' )
79
88
} )
89
+
90
+ it ( 'renders prop text in child when child is span' , ( ) => {
91
+ const wrapper = mount ( BBreadcrumbItem , {
92
+ props : { active : true , text : 'foobar' } ,
93
+ } )
94
+ const $span = wrapper . get ( 'span' )
95
+ expect ( $span . text ( ) ) . toBe ( 'foobar' )
96
+ } )
97
+
98
+ it ( 'renders prop text in child when child is span' , ( ) => {
99
+ const wrapper = mount ( BBreadcrumbItem , {
100
+ props : { active : true , text : 'props' } ,
101
+ slots : { default : 'slots' } ,
102
+ } )
103
+ const $span = wrapper . get ( 'span' )
104
+ expect ( $span . text ( ) ) . toBe ( 'slots' )
105
+ } )
106
+
107
+ it ( 'does not give prop active to child' , ( ) => {
108
+ const wrapper = mount ( BBreadcrumbItem , {
109
+ props : { active : true } ,
110
+ } )
111
+ const $span = wrapper . get ( 'span' )
112
+ expect ( $span . attributes ( 'active' ) ) . toBeUndefined ( )
113
+ } )
114
+
115
+ it ( 'does not give prop ariaCurrent to child' , ( ) => {
116
+ const wrapper = mount ( BBreadcrumbItem , {
117
+ props : { active : true , ariaCurrent : 'foobar' } ,
118
+ } )
119
+ const $span = wrapper . get ( 'span' )
120
+ expect ( $span . attributes ( 'ariaCurrent' ) ) . toBeUndefined ( )
121
+ } )
122
+
123
+ it ( 'does not give prop disabled to child' , ( ) => {
124
+ const wrapper = mount ( BBreadcrumbItem , {
125
+ props : { active : true , disabled : true } ,
126
+ } )
127
+ const $span = wrapper . get ( 'span' )
128
+ expect ( $span . attributes ( 'disabled' ) ) . toBeUndefined ( )
129
+ } )
130
+
131
+ it ( 'does not give prop text to child' , ( ) => {
132
+ const wrapper = mount ( BBreadcrumbItem , {
133
+ props : { active : true , text : 'foobar' } ,
134
+ } )
135
+ const $span = wrapper . get ( 'span' )
136
+ expect ( $span . attributes ( 'text' ) ) . toBeUndefined ( )
137
+ } )
138
+
139
+ it ( 'gives prop active to child when blink' , ( ) => {
140
+ const wrapper = mount ( BBreadcrumbItem , {
141
+ props : { active : false } ,
142
+ } )
143
+ const $blink = wrapper . getComponent ( BLink )
144
+ expect ( $blink . props ( 'active' ) ) . toBe ( false )
145
+ } )
146
+
147
+ it ( 'does not give prop ariaCurrent to child when blink' , ( ) => {
148
+ const wrapper = mount ( BBreadcrumbItem , {
149
+ props : { active : false , ariaCurrent : 'foobar' } ,
150
+ } )
151
+ const $blink = wrapper . getComponent ( BLink )
152
+ expect ( $blink . props ( 'ariaCurrent' ) ) . toBeUndefined ( )
153
+ } )
154
+
155
+ it ( 'gives prop disabled to child when blink' , ( ) => {
156
+ const wrapper = mount ( BBreadcrumbItem , {
157
+ props : { active : false , disabled : true } ,
158
+ } )
159
+ const $blink = wrapper . getComponent ( BLink )
160
+ expect ( $blink . props ( 'disabled' ) ) . toBe ( true )
161
+ } )
162
+
163
+ it ( 'does not give prop text to child when blink' , ( ) => {
164
+ const wrapper = mount ( BBreadcrumbItem , {
165
+ props : { active : false , text : 'foobar' } ,
166
+ } )
167
+ const $blink = wrapper . getComponent ( BLink )
168
+ expect ( $blink . props ( 'text' ) ) . toBeUndefined ( )
169
+ } )
170
+
171
+ it ( 'gives prop activeClass to blink' , ( ) => {
172
+ const wrapper = mount ( BBreadcrumbItem , {
173
+ props : { activeClass : 'foobar' } ,
174
+ } )
175
+ const $blink = wrapper . getComponent ( BLink )
176
+ expect ( $blink . props ( 'activeClass' ) ) . toBe ( 'foobar' )
177
+ } )
80
178
} )
0 commit comments