@@ -215,6 +215,28 @@ describe('rc-trigger', function main() {
215
215
} ] , done ) ;
216
216
} ) ;
217
217
218
+ it ( 'contextMenu works' , done => {
219
+ const trigger = ReactDOM . render ( (
220
+ < Trigger
221
+ action = { [ 'contextMenu' ] }
222
+ popupAlign = { placementAlignMap . left }
223
+ popup = { < strong > trigger</ strong > }
224
+ >
225
+ < div className = "target" > contextMenu</ div >
226
+ </ Trigger >
227
+ ) , div ) ;
228
+
229
+ const target = scryRenderedDOMComponentsWithClass ( trigger , 'target' ) [ 0 ] ;
230
+ // can not simulate mouseenter
231
+ Simulate . contextMenu ( target ) ;
232
+ async . series ( [ timeout ( 200 ) , ( next ) => {
233
+ const popupDomNode = trigger . getPopupDomNode ( ) ;
234
+ expect ( popupDomNode ) . to . be . ok ( ) ;
235
+ expect ( $ ( popupDomNode ) . css ( 'display' ) ) . to . be ( 'block' ) ;
236
+ next ( ) ;
237
+ } ] , done ) ;
238
+ } ) ;
239
+
218
240
it ( 'afterPopupVisibleChange can be triggered' , ( done ) => {
219
241
let triggered = 0 ;
220
242
const trigger = ReactDOM . render ( (
@@ -601,33 +623,33 @@ describe('rc-trigger', function main() {
601
623
const domNode = ReactDOM . findDOMNode ( trigger ) ;
602
624
Simulate . click ( domNode ) ;
603
625
async . series ( [ timeout ( 100 ) ,
604
- ( next ) => {
605
- const popupDomNode = trigger . getPopupDomNode ( ) ;
606
- expect ( popupDomNode ) . to . be . ok ( ) ;
607
- expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . not . to . be ( '1' ) ;
608
- next ( ) ;
609
- } ,
610
- timeout ( 500 ) ,
611
- ( next ) => {
612
- const popupDomNode = trigger . getPopupDomNode ( ) ;
613
- expect ( popupDomNode ) . to . be . ok ( ) ;
614
- expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . to . be ( '1' ) ;
615
- Simulate . click ( domNode ) ;
616
- next ( ) ;
617
- } ,
618
- timeout ( 100 ) ,
619
- ( next ) => {
620
- const popupDomNode = trigger . getPopupDomNode ( ) ;
621
- expect ( popupDomNode ) . to . be . ok ( ) ;
622
- expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . not . to . be ( '1' ) ;
623
- next ( ) ;
624
- } ,
625
- timeout ( 500 ) ,
626
- ( next ) => {
627
- const popupDomNode = trigger . getPopupDomNode ( ) ;
628
- expect ( $ ( popupDomNode ) . css ( 'display' ) ) . to . be ( 'none' ) ;
629
- next ( ) ;
630
- } ] ,
626
+ ( next ) => {
627
+ const popupDomNode = trigger . getPopupDomNode ( ) ;
628
+ expect ( popupDomNode ) . to . be . ok ( ) ;
629
+ expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . not . to . be ( '1' ) ;
630
+ next ( ) ;
631
+ } ,
632
+ timeout ( 500 ) ,
633
+ ( next ) => {
634
+ const popupDomNode = trigger . getPopupDomNode ( ) ;
635
+ expect ( popupDomNode ) . to . be . ok ( ) ;
636
+ expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . to . be ( '1' ) ;
637
+ Simulate . click ( domNode ) ;
638
+ next ( ) ;
639
+ } ,
640
+ timeout ( 100 ) ,
641
+ ( next ) => {
642
+ const popupDomNode = trigger . getPopupDomNode ( ) ;
643
+ expect ( popupDomNode ) . to . be . ok ( ) ;
644
+ expect ( $ ( popupDomNode ) . css ( 'opacity' ) ) . not . to . be ( '1' ) ;
645
+ next ( ) ;
646
+ } ,
647
+ timeout ( 500 ) ,
648
+ ( next ) => {
649
+ const popupDomNode = trigger . getPopupDomNode ( ) ;
650
+ expect ( $ ( popupDomNode ) . css ( 'display' ) ) . to . be ( 'none' ) ;
651
+ next ( ) ;
652
+ } ] ,
631
653
done ) ;
632
654
} ) ;
633
655
} ) ;
0 commit comments