more test cases

This commit is contained in:
afc163 2018-05-25 20:59:17 +08:00 committed by 偏右
parent 93b14da4a6
commit 3a445f3e75
2 changed files with 17 additions and 5 deletions

View File

@ -83,4 +83,19 @@ describe('Modal.confirm triggers callbacks correctly', () => {
expect($$('.ant-btn')).toHaveLength(1);
expect($$('.ant-btn')[0].innerHTML).toContain('OK');
});
it('trigger onCancel once when click on cancel button', () => {
jest.useFakeTimers();
['info', 'success', 'warning', 'error'].forEach((type) => {
Modal[type]({
title: 'title',
content: 'content',
});
expect($$(`.ant-confirm-${type}`)).toHaveLength(1);
$$('.ant-btn')[0].click();
jest.runAllTimers();
expect($$(`.ant-confirm-${type}`)).toHaveLength(0);
});
jest.useRealTimers();
});
});

View File

@ -1,9 +1,6 @@
import * as React from 'react';
import Button from '../button';
function noop() {
}
export interface TransferOperationProps {
className?: string;
leftArrowText?: string;
@ -17,8 +14,8 @@ export interface TransferOperationProps {
export default class Operation extends React.Component<TransferOperationProps, any> {
render() {
const {
moveToLeft = noop,
moveToRight = noop,
moveToLeft,
moveToRight,
leftArrowText = '',
rightArrowText = '',
leftActive,