vue-test-utils:触发keydown.tab时,焦点元素未更改

问题描述

请考虑以下测试代码。当使用包装器触发标签时,按焦点元素不会更改。

我做错了还是对包装器行为的期望错了?

预期结果:export default function VaccinationListScreen(props) { const [expand,setExpand] = useState(false); const [data,setData] = useState(""); const VaccinationListItem = (item) => { const [expand,setExpand] = useState(false); return ( <TouchableOpacity style={{ padding: 10 }} onPress={() => setExpand(true)}> <View style={{ padding: 10,backgroundColor: "#fff",elevation: 3,margin: "2%",borderRadius: 5,}} key={item.id} > <View style={{ alignItems: "flex-end" }}> <Text style={{ color: "grey",fontSize: 12 }}> {item.display_date} </Text> </View> <View style={{ flexDirection: "row" }}> <View> <Image source={require("../../assets/atbirth.jpg")} style={{ height: 40,width: 50 }} resizeMode="contain" /> </View> <View style={{ flex: 1 }}> <View style={{ flexDirection: "row",flex: 1 }}> <Text key={item.id} style={{ fontFamily: "Roboto",fontSize: 18,fontWeight: "bold",}} > {item.name} </Text> </View> <View style={{ flexDirection: "row",width: "30%" }}> {item.vaccine_list.map((i) => { return ( <View style={{ flexDirection: "row" }}> <Text numberOfLines={1} ellipsizeMode="tail" style={{ fontFamily: "Roboto",fontSize: 15 }} > {i.name},</Text> </View> ); })} </View> </View> </View> <View style={{ alignItems: "flex-end",marginTop: "1%" }}> <View style={{ flexDirection: "row" }}> <Text style={{ color: "red",fontSize: 14,}} > {item.child_vacc_status.text} </Text> <Icon name="chevron-up" color="red" size={12} style={{ marginTop: "1%",marginLeft: "1%" }} /> </View> </View> </View> </TouchableOpacity> ); }; return ( <SafeAreaView> <ScrollView> {data != undefined && data != null && data.map((item) => { VaccinationListItem(item); })} </ScrollView> </SafeAreaView> ); } 被聚焦

实际结果:#bar被关注

#foo

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)