1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/thoughtworks-taro-testing-library

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
snapshot-component.test.tsx 976
Копировать Редактировать Исходные данные Просмотреть построчно История
jiachen Отправлено 5 лет назад 4340154
import Taro, {Component} from '@tarojs/taro';
import { render } from '../index';
import {StandardProps} from "@tarojs/components/types/common";
import {Text} from "@tarojs/components";
interface CounterProps extends StandardProps {
initial?: number;
}
interface CounterState {
count: number;
}
class Counter extends Component<CounterProps, CounterState> {
static defaultProps = {
initial: 1
}
static externalClasses = ['custom-class'];
constructor(props: CounterProps) {
super(props);
this.state = {
count: props.initial as number
}
}
render() {
const { count } = this.state
return (
<Text
onClick={() => {this.setState({
count: count + 1
})}}
className="number custom-class"
>{count}</Text>
)
}
}
describe('snapshot test', () => {
it('should pass snapshot', () => {
const { baseElement } = render(<Counter />);
expect(baseElement).toMatchSnapshot()
});
});

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/thoughtworks-taro-testing-library.git
git@gitlife.ru:oschina-mirror/thoughtworks-taro-testing-library.git
oschina-mirror
thoughtworks-taro-testing-library
thoughtworks-taro-testing-library
v1.1.0