principles-ui-components
Version:
Supporting UI controller for Tizen TV web application, which developed base on React Framework.
31 lines (22 loc) • 1.05 kB
JavaScript
import React, { Component }from 'react';
import {shallow, mount} from 'enzyme';
import ProgressBar from '../UI_Component/ProgressBar';
jest.useFakeTimers();
describe ('<ProgressBar />', () => {
it ('ProgressBar unit test,start Progress, unhighContarst, start from -1 ', () => {
const barWrapper = mount(<ProgressBar bgWidth={100} progressRate={-1} bufferingShowValue={true}/>);
barWrapper.setProps({progressRate: 100});
jest.runTimersToTime(1000);
const barInst = barWrapper.instance();
const e ={target: 'div', currentTarget: 'div', type: 'transitionend', preventDefault: jest.fn()};
barInst.animationDone(e);
barWrapper.unmount();
});
it ('ProgressBar unit test,start Progress, unhighContarst, start from 100 ', () => {
const barWrapper = mount(<ProgressBar bgWidth={100} progressRate={100}
bufferingShowValue={true} highContarstValue={true}/>);
barWrapper.setProps({progressRate: -1});
jest.runTimersToTime(1000);
barWrapper.unmount();
});
});