masteroy
masteroy
**问题描述** 下面代码中,`ComponentA`中的`list`更新后,`ComponentB`中的`list`不更新 ```js export function ComponentA() { const [list, setList] = useState([]); useEffect(() => { setTimeout(() => setList([1, 2, 3, 4, 5]), 1000); }, []); if (list.length === 0) return...
**问题描述** 使用hooks的组件Jest快照测试报错 **复现步骤** #### TestComponent.tsx ```js import Taro, { useState } from '@tarojs/taro'; import { View, Text } from '@tarojs/components'; export function TestComponent() { const [ count, setCount ] =...
**问题描述** 之前提过相关的issue: https://github.com/NervJS/taro/issues/3342 但更新到最新的nervjs后依然报错 ``` invalid hooks call: hooks can only be called in a stateless component. ``` 这是我的依赖版本 ``` $ yarn list --pattern "nerv|tarojs" yarn list v1.6.0 ├─ @tarojs/[email protected]...
希望Taro cli现在只显示中文,希望支持包括英语在内的多语言 
**问题描述** Component使用单个useEffect时单元测试没问题, 但Component使用多个useEffect时,单元测试会报错 ``` Terminal ReferenceError: Taro is not defined ``` **复现步骤** 代码可参考此repo: https://github.com/masteroy/taro-unit-test/blob/master/src/components/MultipleUseEffect.tsx **期望行为** [这里请用简洁清晰的语言描述你期望的行为] **报错信息** [这里请贴上你的**完整**报错截图或文字] **系统信息** > Taro v1.2 及以上版本已添加 `taro info` 命令,方便大家查看系统及依赖信息,运行该命令后将结果贴下面即可。 Taro CLI 1.3.13 environment...
**问题描述** 默认的page导出方式是这样: ``` javascript // index.tsx export default class Index extends Component { .... } // app.tsx import Index from './pages/index' ... ``` 如果采用named export的方式: ``` javascript // index.tsx export...
请问在单元测试中怎么触发component重渲染?期望能够在组件状态更新后去match snapshot。 ``` javascript let component = renderIntoDocument(); const searchInput = findComponetByType(component, 'SearchInput')[0]; searchInput.props.onToggleAutoComplete(true, 'test'); // 此时component内部的state已经改变,想要强制刷新,确保rerender的dom正确 expect(component).toMatchSnapshot(); ```
在做单元测试时,发现`nerv-test-utils`提供的scryRenderedComponentsWithType没正常工作,找不到对应的组件。 下面的例子,期望能够找到2个Button组件,但scryRenderedComponentsWithType返回0。 ``` typescript // Counter.tsx import Taro, { useState, useEffect } from "@tarojs/taro"; import { View, Button, Text } from "@tarojs/components"; interface Props { initCount: number } export function...
I use validator date well in version 0.13, but when I upgrade my zotonic to 1.0-dev, I found that it always print "please correct". I trace the code, and found...