1
1
import { shallow , configure } from 'enzyme' ;
2
2
3
3
import React from 'react' ;
4
-
4
+ import ReactDOM from 'react-dom' ;
5
5
import TravelContainer from '../containers/TravelContainer' ;
6
+ // import MainContainer from '../containers/MainContainer';
7
+ import Dropdown from '../components/Dropdown' ;
6
8
7
9
import Adapter from 'enzyme-adapter-react-16' ;
8
10
@@ -20,6 +22,21 @@ const props = {
20
22
pause : jest . fn ( )
21
23
}
22
24
25
+ const dropdownProps = {
26
+ selectedOption : {
27
+ value : 1 ,
28
+ label : 'label'
29
+ } ,
30
+ options : [ 0.5 , 1 , 2 ] ,
31
+ onChange : jest . fn ( ) ,
32
+ }
33
+
34
+ const options = [
35
+ { value : 2000 , label : '0.5x' } ,
36
+ { value : 1000 , label : '1.0x' } ,
37
+ { value : 500 , label : '2.0x' } ,
38
+ ] ;
39
+
23
40
describe ( 'testing the backward and forward buttons' , ( ) => {
24
41
test ( 'if the backward button rewinds the playback' , ( ) => {
25
42
const wrapper = shallow ( < TravelContainer { ...props } /> ) ;
@@ -65,4 +82,36 @@ describe('testing the play button', () => {
65
82
66
83
expect ( wrapper . find ( '.play-button' ) . text ( ) ) . toBe ( 'Pause' ) ;
67
84
} )
85
+ } )
86
+
87
+ describe ( 'testing the playback speed' , ( ) => {
88
+ test ( 'if the playback dropdown states 0.5x the speed should be 0.5x' , ( ) => {
89
+
90
+ const wrapper = render ( < TravelContainer { ...props } /> ) ;
91
+
92
+ wrapper . find ( 'Dropdown' ) . simulate ( 'change' , { value : [ 'val' ] } ) ;
93
+ // wrapper.find('select').simulate('change', { value : 'hello'});
94
+ // console.log('val',wrapper.find('Dropdown').simulate('select', { value: ['val'] }));
95
+ // expect(wrapper.find('Dropdown').text()).toBe('0.5x')
96
+ expect ( wrapper . find ( 'select [selected]' ) . val ( ) ) . to . equal ( 'key' )
97
+
98
+ } ) ;
99
+
100
+ // test('if the playback dropdown states 1x the speed should be 1x', () => {
101
+
102
+ // const wrapper = shallow(<TravelContainer { ...dropdownProps } />);
103
+
104
+ // expect(wrapper.find('Dropdown').label).toBe('1.0x')
105
+
106
+ // });
107
+
108
+ // test('if the playback dropdown states 2x the speed should be 2x', () => {
109
+
110
+ // const wrapper = shallow(<TravelContainer { ...dropdownProps } />);
111
+
112
+ // wrapper.find('Dropdown').simulate('click');
113
+
114
+ // expect(wrapper.find('Dropdown').label).toBe('2.0x')
115
+
116
+ // });
68
117
} )
0 commit comments