@@ -108,16 +108,18 @@ describe('createPanelConsumerMixin', () => {
108108 attributeName : false ,
109109 } ;
110110
111- expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 0 ) ;
111+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
112+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , false ) ;
112113
113114 wrapper . vm . state = {
114115 attributeName : true ,
115116 } ;
116117
117- expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
118+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 2 ) ;
119+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , true ) ;
118120 } ) ;
119121
120- it ( 'emits at least once when both values are set' , ( ) => {
122+ it ( 'emits once when both values are set' , ( ) => {
121123 const localVue = createLocalVue ( ) ;
122124 const emitter = createFakeEmitter ( ) ;
123125 const Test = createFakeComponent ( localVue ) ;
@@ -137,7 +139,8 @@ describe('createPanelConsumerMixin', () => {
137139 attributeName : false ,
138140 } ;
139141
140- expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 0 ) ;
142+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
143+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , false ) ;
141144
142145 wrapper . vm . state = {
143146 attributeName : false ,
@@ -146,7 +149,7 @@ describe('createPanelConsumerMixin', () => {
146149 expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
147150 } ) ;
148151
149- it ( 'do not emit when the previous value is not set ' , ( ) => {
152+ it ( 'emits once on init of the component ' , ( ) => {
150153 const localVue = createLocalVue ( ) ;
151154 const emitter = createFakeEmitter ( ) ;
152155 const Test = createFakeComponent ( localVue ) ;
@@ -166,7 +169,8 @@ describe('createPanelConsumerMixin', () => {
166169 attributeName : true ,
167170 } ;
168171
169- expect ( emitter . $emit ) . not . toHaveBeenCalled ( ) ;
172+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
173+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , true ) ;
170174 } ) ;
171175
172176 it ( 'do not emit when the next value is not set' , ( ) => {
@@ -189,11 +193,12 @@ describe('createPanelConsumerMixin', () => {
189193 attributeName : true ,
190194 } ;
191195
192- expect ( emitter . $emit ) . not . toHaveBeenCalled ( ) ;
196+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
197+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , true ) ;
193198
194199 wrapper . vm . state = null ;
195200
196- expect ( emitter . $emit ) . not . toHaveBeenCalled ( ) ;
201+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
197202 } ) ;
198203
199204 it ( 'do not emit when the previous and next value are equal' , ( ) => {
@@ -216,18 +221,20 @@ describe('createPanelConsumerMixin', () => {
216221 attributeName : true ,
217222 } ;
218223
219- expect ( emitter . $emit ) . not . toHaveBeenCalled ( ) ;
224+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
225+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , true ) ;
220226
221227 wrapper . vm . state = {
222228 attributeName : false ,
223229 } ;
224230
225- expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
231+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 2 ) ;
232+ expect ( emitter . $emit ) . toHaveBeenLastCalledWith ( PANEL_CHANGE_EVENT , false ) ;
226233
227234 wrapper . vm . state = {
228235 attributeName : false ,
229236 } ;
230237
231- expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 1 ) ;
238+ expect ( emitter . $emit ) . toHaveBeenCalledTimes ( 2 ) ;
232239 } ) ;
233240} ) ;
0 commit comments