@@ -48,6 +48,7 @@ describe('Component', () => {
4848 const onMouseDown = sinon . spy ( ) ;
4949 const onMouseOver = sinon . spy ( ) ;
5050 const onDoubleClick = sinon . spy ( ) ;
51+ const onContextMenu = sinon . spy ( ) ;
5152 const wrapper = shallow (
5253 < DataCell
5354 row = { 2 }
@@ -61,6 +62,7 @@ describe('Component', () => {
6162 onMouseDown = { onMouseDown }
6263 onDoubleClick = { onDoubleClick }
6364 onMouseOver = { onMouseOver }
65+ onContextMenu = { onContextMenu }
6466 />
6567 ) ;
6668
@@ -73,10 +75,14 @@ describe('Component', () => {
7375 wrapper . simulate ( 'mousedown' ) ;
7476 wrapper . simulate ( 'doubleclick' ) ;
7577 wrapper . simulate ( 'mouseover' ) ;
78+ wrapper . simulate ( 'contextmenu' ) ;
7679
7780 expect ( onDoubleClick . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
7881 expect ( onMouseDown . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
7982 expect ( onMouseOver . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
83+ const args = onContextMenu . getCall ( 0 ) . args ;
84+ expect ( args [ 1 ] ) . toEqual ( 2 ) ;
85+ expect ( args [ 2 ] ) . toEqual ( 3 ) ;
8086 wrapper . unmount ( ) ;
8187 } )
8288
@@ -90,7 +96,9 @@ describe('Component', () => {
9096 col : 1 ,
9197 onMouseDown : ( ) => { } ,
9298 onMouseOver : ( ) => { } ,
93- onDoubleClick : ( ) => { } }
99+ onDoubleClick : ( ) => { } ,
100+ onContextMenu : ( ) => { } ,
101+ }
94102 const wrapper = shallow (
95103 < DataCell
96104 { ...props }
@@ -121,7 +129,9 @@ describe('Component', () => {
121129 col : 1 ,
122130 onMouseDown : ( ) => { } ,
123131 onMouseOver : ( ) => { } ,
124- onDoubleClick : ( ) => { } }
132+ onDoubleClick : ( ) => { } ,
133+ onContextMenu : ( ) => { } ,
134+ }
125135 const wrapper = shallow (
126136 < DataCell
127137 { ...props }
@@ -153,7 +163,9 @@ describe('Component', () => {
153163 onChange : sinon . spy ( ) ,
154164 onMouseDown : ( ) => { } ,
155165 onDoubleClick : ( ) => { } ,
156- onMouseOver : ( ) => { } }
166+ onMouseOver : ( ) => { } ,
167+ onContextMenu : ( ) => { } ,
168+ }
157169 document . body . innerHTML = '<table><tbody><tr id="root"></tr></tbody></table>'
158170 wrapper = mount ( < DataCell { ...props } /> , { attachTo : document . getElementById ( 'root' ) } ) ;
159171 } ) ;
@@ -201,6 +213,7 @@ describe('Component', () => {
201213 const onMouseDown = sinon . spy ( ) ;
202214 const onMouseOver = sinon . spy ( ) ;
203215 const onDoubleClick = sinon . spy ( ) ;
216+ const onContextMenu = sinon . spy ( ) ;
204217 const wrapper = shallow (
205218 < ComponentCell
206219 row = { 2 }
@@ -217,6 +230,7 @@ describe('Component', () => {
217230 onMouseDown = { onMouseDown }
218231 onDoubleClick = { onDoubleClick }
219232 onMouseOver = { onMouseOver }
233+ onContextMenu = { onContextMenu }
220234 />
221235 ) ;
222236
@@ -237,10 +251,14 @@ describe('Component', () => {
237251 wrapper . simulate ( 'mousedown' ) ;
238252 wrapper . simulate ( 'doubleclick' ) ;
239253 wrapper . simulate ( 'mouseover' ) ;
254+ wrapper . simulate ( 'contextmenu' ) ;
240255
241256 expect ( onDoubleClick . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
242257 expect ( onMouseDown . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
243258 expect ( onMouseOver . calledWith ( 2 , 3 ) ) . toEqual ( true ) ;
259+ const args = onContextMenu . getCall ( 0 ) . args ;
260+ expect ( args [ 1 ] ) . toEqual ( 2 ) ;
261+ expect ( args [ 2 ] ) . toEqual ( 3 ) ;
244262 wrapper . unmount ( ) ;
245263
246264 } )
@@ -261,6 +279,7 @@ describe('Component', () => {
261279 onMouseDown = { ( ) => { } }
262280 onDoubleClick = { ( ) => { } }
263281 onMouseOver = { ( ) => { } }
282+ onContextMenu = { ( ) => { } }
264283 />
265284 ) ;
266285 wrapper . setProps ( { value : 7 } )
0 commit comments