我有以下示例组件
export default class Header extends Component{
render(){
let activeStyle = {"backgroundColor": "green"};
let inActiveStyle = {"backgroundColor": "red"};
return(
<div className="profile-header" style={(this.props.active)?
activeStyle:inActiveStyle}>
<input type="checkbox" checked={this.props.active} readOnly/>
</div>
);
}
}
Run Code Online (Sandbox Code Playgroud)
使用酶和柴我想断言,为
this.props.active = true
Run Code Online (Sandbox Code Playgroud)
backgroundColor为绿色,并选中复选框.
这是我的测试用例
describe('<Header />', () => {
it('valid component', () => {
const wrapper = shallow(<ProfileHeader
active= {true}
/>);
????
});
Run Code Online (Sandbox Code Playgroud)
但我怎么能断言这两种情况呢?
我正在尝试使用momentjs解析String:
let date = "19. Juli 2016 05:00";
Run Code Online (Sandbox Code Playgroud)
该字符串包含7月份用德语写的月份,根据momentjs doc,它具有"LLL"格式.
当我尝试解析它时
moment(date,'LLL');
Run Code Online (Sandbox Code Playgroud)
我错了约会.
当我尝试解析它时
moment(date,'LLL','de');
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
TypeError:config._locale为null.
我怎样才能正确解析这个字符串?
我有一个在AWS Lambda上运行的python脚本,它试图连接到我在EC2实例上设置的MariaDB.
该脚本无法执行,因为我的EC2实例的安全组只允许某些IP.如何允许Lambda函数访问?