Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen committed Jun 21, 2019
1 parent 0be9333 commit d020a76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/__tests__/ProgressControl.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { shallow, mount } from 'enzyme';
import ProgressControl from '../components/control-bar/ProgressControl';

describe('ProgressControl', () => {
Expand All @@ -13,4 +13,9 @@ describe('ProgressControl', () => {
const wrapper = shallow(<ProgressControl actions={{}} player={{}} />);
expect(wrapper.hasClass('video-react-progress-control')).toBe(true);
});

it('should bind ref "seekBar"', () => {
const wrapper = mount(<ProgressControl player={{}} />);
expect(wrapper.instance().seekBar).toBeTruthy();
});
});
12 changes: 11 additions & 1 deletion src/__tests__/Slider.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { shallow, mount } from 'enzyme';
import Slider from '../components/Slider';

describe('Slider', () => {
Expand All @@ -8,6 +8,11 @@ describe('Slider', () => {
expect(wrapper.type()).toBe('div');
});

it('should render with "video-react-slider" class', () => {
const wrapper = shallow(<Slider actions={{}} player={{}} />);
expect(wrapper.hasClass('video-react-slider')).toBe(true);
});

it('simulates click events', () => {
const e = {
preventDefault: jest.fn(),
Expand All @@ -30,4 +35,9 @@ describe('Slider', () => {
);
expect(wrapper.children().length).toBeGreaterThan(0);
});

it('should bind ref "slider"', () => {
const wrapper = mount(<Slider player={{}} />);
expect(wrapper.instance().slider).toBeTruthy();
});
});

0 comments on commit d020a76

Please sign in to comment.