运行以下测试文件时出现以下错误:
// TestComp.test.tsx
import React from "react";
import { TextInput, View } from "react-native";
import { render, fireEvent } from "@testing-library/react-native";
const TestComp = () => {
return (
<View>
<TextInput testID="test-input" onChangeText={(txt) => console.log(txt)}></TextInput>
</View>
);
};
describe("Testcomp", () => {
afterEach(() => {
jest.clearAllMocks();
});
test("test me", async () => {
const { getByTestId } = render(<TestComp />);
const testInput = getByTestId("test-input");
fireEvent.changeText(testInput, "hello");
});
});
Run Code Online (Sandbox Code Playgroud)
运行时出错yarn jest:
Details:
/mnt/ubuntu/home/richardwu/code/topspin/src/components/TestComp.test.tsx:46
return (<react_native_1.View>
^
SyntaxError: Unexpected token …Run Code Online (Sandbox Code Playgroud) 我一直在关注本指南https://medium.com/@pellea/using-adb-with-wsl2-7aebbb070a47到目前为止,WSL2 可以通过 Android Studios 看到在 Windows 上运行的模拟器-> AVD 管理器。例如,在 Windows 和 WSL2 上,adb devices正确显示:
List of devices attached
emulator-5554 device
Run Code Online (Sandbox Code Playgroud)
但是,当我转到我的 expo 应用程序并尝试启动 Android 模拟器时,我收到以下错误消息:
Couldn't start project on Android: could not connect to TCP port 5554: Connection refused
Run Code Online (Sandbox Code Playgroud)
这是在我尝试以下操作之后:
ADB_SERVER_SOCKET=tcp:<MY IP>:5037在我的 WSL2 配置文件中导出Set-NetFirewallProfile -DisabledInterfaceAliases "vEthernet (WSL)"
Run Code Online (Sandbox Code Playgroud)
$WSL_CLIENT = bash.exe -c "ip addr show eth0 | …Run Code Online (Sandbox Code Playgroud) 我有以下几点react-native-form:
const { register, handleSubmit, setValue, errors } = useForm();
const onSubmit = (data) => {
console.log(data);
return firebase
.auth()
.signInWithEmailAndPassword(data.email, data.password)
.then((info) => {
console.log(info.additionalUserInfo.profile);
})
.catch((err) => {
console.error(err);
});
};
<View>
<TextInput
placeholder="Email"
testID="email-input"
onChangeText={(t) => setValue("email", t)}
style={styles.loginTextInput}
></TextInput>
<TextInput
secureTextEntry={true}
testID="password-input"
placeholder="Password (min. 8 characters)"
onChangeText={(t) => setValue("password", t)}
style={styles.loginTextInput}
></TextInput>
<TouchableOpacity
onPress={handleSubmit(onSubmit)}
testID={"login-email-button"}
style={[styles.loginButton, styles.loginEmailButton]}
>
<Text style={styles.buttonText}>Login with Email</Text>
</TouchableOpacity>
</View>
Run Code Online (Sandbox Code Playgroud)
我正在测试提交和调用firebase.auth().signInWithEmailAndPasswordusingjest在以下测试中:
test("submit works", async () => …Run Code Online (Sandbox Code Playgroud) 我刚刚将Materialise集成到我的Rails项目中gem 'materialize-sass'.出于某种原因,选择输入显示两个插入符号而不是1.
select输入的代码基本上是他们网站上示例的一个分支.
<div class="input-field">
<select name="tutor_profile[dob_month]" id="tutor_profile_dob_month">
<option value="" disabled selected>Choose your month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<label>Birthday</label>
</div>
Run Code Online (Sandbox Code Playgroud)
我试过调整开发人员控制台中的选择按钮的CSS样式,但没有成功.选择输入中的任何元素都没有其他样式.
我正在使用的其他CSS框架是bootstrap,bootstrap-tagsinput,twitter-typeahead和jquery-ui.我想知道是否有人有类似的经历.
我尝试使用!=和not-in作为参数,如下Query.where所述:
db.collection("users")
.where(firebase.firestore.FieldPath.documentId(), "!=", curUser.uid)
.get()
.then((snapshot) => {
...
});
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
为函数 Query.where() 的第二个参数提供的值“!=”无效。可接受的值:<、<=、==、>=、>、array-contains、in、array-contains-any
我什至在普通的非文档 ID 字段上尝试过此操作,但它给出了相同的错误。
我使用的是节点包firebase版本 7.9.0。
我已经在我的Rails项目中导入了fullcalendar gem 'fullcalendar-rails', '~> 2.3.1.0'.
每当我在我的日历上拖动事件时,都存在显着的"延迟",即事件UI元素在周围徘徊.http://fullcalendar.io上的版本明显更好.
有没有人有同样的问题和/或你如何解决它?
编辑:
我忽略了包含任何实现代码,因为即使使用vanilla实现也无法使日历工作,所以我认为这是fullcalendar-rails的一个问题.我在下面包含了我的解决方案(碰巧是designmodo的flat-ui样式表的错误).
我想在通过 Devise 发送的所有电子邮件的 to/bcc 标头中包含我用户的名字和姓氏。
我看了这个https://github.com/plataformatec/devise/blob/master/lib/devise/mailers/helpers.rb#L28
似乎 Devise 也像@email在模板中一样分配了 to 字段。我将如何覆盖标头,以便使用 to/bcc 标头发送电子邮件"FirstName LastName <email@example.com>"?
假设我有一个JS对象,其中包含多个具有相同属性的对象.
编辑:我将外括号修改为方括号以反映实际对象是什么.接受的答案在评论中.
var object = [
{
id: 1,
foo: 'bar'
},
{
id: 2,
foo: 'bar2'
},
{
id: 3,
foo: 'bar3'
},
{
id: 4,
foo: 'bar4'
}
];
Run Code Online (Sandbox Code Playgroud)
我如何获得具有特定id的对象,例如id == 1类似于Rails方法的东西ActiveRecord::Relation.where(id: 1)?
javascript ×2
jestjs ×2
adb ×1
babeljs ×1
calendar ×1
devise ×1
expo ×1
firebase ×1
fullcalendar ×1
jquery ×1
jquery-ui ×1
materialize ×1