我在两个文件中声明了同名变量.我按以下顺序导入它们并发现冲突.
FileName:Modal.scss
$gray : #e1e1e1; // Imported first
Run Code Online (Sandbox Code Playgroud)
FileName:Variable.scss
$gray : #999; // imported later
Run Code Online (Sandbox Code Playgroud)
预期的行为是应该覆盖Value.但是,我在CSS中获得了第一个导入值(#e1e1e1)而不是(#999).
我做错了多次声明变量吗?
我正在使用“ aws-amplify”库中的signIn方法。我在开玩笑地运行测试用例时无法从该库调用signIn方法。
码:
import { Auth } from "aws-amplify"; // import statement
//code for function
handleSubmit = async event => {
event.preventDefault();
this.setState({ isLoading: true });
try {
await Auth.signIn(this.state.username, this.state.password);
this.props.history.push("/dashboard");
} catch (e) {
this.setState({ isLoading: false });
}
}
Run Code Online (Sandbox Code Playgroud)
测试文件:
it('calls event handler; "handleSubmit"', async() => {
const componentInstance = Wrapper2.dive().instance();
componentInstance.setState({
isLoading : false,
username : "demo",
password : "demo"
})
const event = {
preventDefault : () => {}
};
await componentInstance.handleSubmit(event);
expect(componentInstance.state.isLoading).toEqual(true);
});
Run Code Online (Sandbox Code Playgroud)
在测试用例之上运行时,它总是进入handleSubmit()函数的catch部分。 …
我想知道如何在一个查询中在同一个表中交换同一列的值.
例如,Table如下所示.
SerialNo Status
1 Married
2 Single
3 Married
Run Code Online (Sandbox Code Playgroud)
现在,结果我想要的是"结婚"应该转换成单身,"单身"应该转换成结婚.
预期:
SerialNo Status
1 Single
2 Married
3 Single
Run Code Online (Sandbox Code Playgroud)
这应该只在一个查询中完成.是否可以使用单个查询执行此操作?如果有,请帮助我.
提前致谢.