mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-29 04:44:52 +08:00
committed by
Nicolas Gallagher
parent
8d80885f5d
commit
17d723559d
@@ -1,5 +1,30 @@
|
|||||||
/* eslint-env jasmine, jest */
|
/* eslint-env jasmine, jest */
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import Button from '..';
|
||||||
|
import { mount, shallow } from 'enzyme';
|
||||||
|
|
||||||
|
const findNativeButton = wrapper => wrapper.getDOMNode();
|
||||||
|
|
||||||
describe('components/Button', () => {
|
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