Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemKosiakevych committed Dec 28, 2016
1 parent 93b5cd8 commit d448263
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
16 changes: 16 additions & 0 deletions Tests/DatePicker.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

import test from 'ava';
import { shallow } from 'enzyme';
import DatePicker from '../DatePicker';

const wrapper = shallow(<DatePicker daysCount={23} format24 />);

test('component exists', (t) => {
t.is(wrapper.length, 1); // exists
});

test('component structure', (t) => {
t.is(wrapper.name(), 'View');
t.is(wrapper.children().length, 3);
});
15 changes: 15 additions & 0 deletions Tests/TimePicker.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import test from 'ava';
import { shallow } from 'enzyme';
import TimePicker from '../TimePicker';
const wrapper = shallow(<TimePicker />);

test('component exists', (t) => {
t.is(wrapper.length, 1); // exists
});

test('component structure', (t) => {
t.is(wrapper.name(), 'View');
t.is(wrapper.children().length, 3);
});
16 changes: 12 additions & 4 deletions Tests/WheelPicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ test('component exists', (t) => {
});

test('component structure', (t) => {
t.is(wrapper.name(), 'WheelPicker'); // the right root component
t.is(wrapper.children().length, 0); // has 1 child
t.is(wrapper.name(), 'WheelPicker');
t.is(wrapper.children().length, 0);
});

test('data', (t) => {
test('props', (t) => {
const data = [1, 2, 3];
const wrapperPress = shallow(<WheelPicker isCyclic={false} isCurved isAtmospheric visibleItemCount={4} backgroundColor={'black'} data={data} />);
const wrapperPress = shallow(<WheelPicker selectedItemTextColor={'yellow'} itemSpace={39} renderIndicator indicatorColor={'grey'} curtainColor={'green'} itemTextColor={'white'} itemTextSize={23} selectedItemPosition={1} isCyclic={false} isCurved isAtmospheric visibleItemCount={4} backgroundColor={'black'} data={data} />);

t.is(wrapperPress.prop('data').length, 3);
t.is(wrapperPress.prop('isCurved'), true);
t.is(wrapperPress.prop('isAtmospheric'), true);
t.is(wrapperPress.prop('isCyclic'), false);
t.is(wrapperPress.prop('visibleItemCount'), 4);
t.is(wrapperPress.prop('backgroundColor'), 'black');
t.is(wrapperPress.prop('selectedItemPosition'), 1);
t.is(wrapperPress.prop('itemTextSize'), 23);
t.is(wrapperPress.prop('itemTextColor'), 'white');
t.is(wrapperPress.prop('curtainColor'), 'green');
t.is(wrapperPress.prop('renderIndicator'), true);
t.is(wrapperPress.prop('indicatorColor'), 'grey');
t.is(wrapperPress.prop('itemSpace'), 39);
t.is(wrapperPress.prop('selectedItemTextColor'), 'yellow');
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-wheel-picker-android",
"version": "0.1.8",
"version": "0.1.9",
"description": "Simple Wheel Picker for Android to use with react-native",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit d448263

Please sign in to comment.