mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 22:55:56 +08:00
committed by
Nicolas Gallagher
parent
8d80885f5d
commit
17d723559d
@@ -1,5 +1,30 @@
|
||||
/* eslint-env jasmine, jest */
|
||||
|
||||
import React from 'react';
|
||||
import Button from '..';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
|
||||
const findNativeButton = wrapper => wrapper.getDOMNode();
|
||||
|
||||
describe('components/Button', () => {
|
||||
test.skip('NO TEST COVERAGE', () => {});
|
||||
test('prop "color"', () => {
|
||||
const onPress = () => {};
|
||||
const color = 'blue';
|
||||
const button = findNativeButton(mount(<Button color={color} onPress={onPress} title="" />));
|
||||
expect(button.style.backgroundColor).toEqual(color);
|
||||
});
|
||||
|
||||
test('prop "onPress"', () => {
|
||||
const onPress = jest.fn();
|
||||
const component = shallow(<Button onPress={onPress} title="" />);
|
||||
component.simulate('press');
|
||||
expect(onPress).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('prop "title"', () => {
|
||||
const onPress = () => {};
|
||||
const text = 'Click me';
|
||||
const component = mount(<Button onPress={onPress} title={text} />);
|
||||
expect(component.text()).toEqual(text);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user