我目前正在尝试评估与React一起使用的不同测试框架,结果证明Jest在我的列表中.但是,我正在尝试使用此处概述的静态属性:https://github.com/jeffmo/es-class-fields-and-static-properties.
所以,我采用了Jest主页上给出的教程,并添加了一个静态propTypes属性,我的代码如下所示:
import React from 'react';
class CheckboxWithLabel extends React.Component {
static defaultProps = {}
constructor(props) {
super(props);
this.state = {isChecked: false};
// since auto-binding is disabled for React's class model
// we can prebind methods here
// http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding
this.onChange = this.onChange.bind(this);
}
onChange() {
this.setState({isChecked: !this.state.isChecked});
}
render() {
return (
<label>
<input
type="checkbox"
checked={this.state.isChecked}
onChange={this.onChange}
/>
{this.state.isChecked ? this.props.labelOn : this.props.labelOff}
</label>
);
}
}
module.exports = CheckboxWithLabel;
Run Code Online (Sandbox Code Playgroud)
当我运行测试(npm test或jest)时,它会抛出以下错误:
? jest
Using Jest …Run Code Online (Sandbox Code Playgroud) 我有一个 docker 容器,我试图从中运行 pyqt 应用程序。除了一部分 GUI 无法呈现外,一切都运行良好。码头日志抛出这个:
libGL error: failed to load driver: swrast
X Error: GLXBadContext 169
Extension: 154 (Uknown extension)
Minor opcode: 6 (Unknown request)
Resource id: 0x6400003
X Error: BadValue (integer parameter out of range for operation) 2
Extension: 154 (Uknown extension)
Minor opcode: 3 (Unknown request)
Resource id: 0x0
...
QGLContext::makeCurrent(): Failed.
Run Code Online (Sandbox Code Playgroud)
在我的 Dockerfile 中,我尝试安装几乎所有我能找到的可能相关的包,包括mesa-utils.
就 docker-compose 文件而言,它是这样的:
version: '2'
services:
gui:
build: .
volumes:
- .:/usr/src
- /tmp/.X11-unix:/tmp/.X11-unix
command: /bin/bash -c "python start.py" …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法来弄清楚如何在 Gmail 上获取特定电子邮件的线程 ID,就在发送之前或单击发送按钮时。
目前,我正在使用 Javascript 以便从电子邮件中删除其他项目并将它们存储在一个记录中,该记录对除线程 ID 之外的所有内容都非常有效。
在 URL 中发送电子邮件后可以找到线程 ID:
https://mail.google.com/mail/u/0/?shva=1#inbox/13ddda647539dcca
Run Code Online (Sandbox Code Playgroud)
在这种情况下,线程 ID(如果我是对的 - 是 13ddda647539dcca。
任何帮助,将不胜感激。
我正在尝试将我的rails应用程序部署到生产中,并且我正在尝试预编译所有资产:
我的assets.rb文件:
Rails.application.config.assets.precompile += %w( *.css.sass )
Rails.application.config.assets.precompile += %w( *.css.scss )
Rails.application.config.assets.precompile += %w( *.css )
Rails.application.config.assets.precompile += %w( *.js )
Rails.application.config.assets.precompile += %w( *.js.coffee )
Rails.application.config.assets.precompile += %w( *.js.coffee.erb )
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用capistrano进行部署时,出现以下错误:
DEBUG[c79c6191] rake aborted!
DEBUG[c79c6191] Sass::SyntaxError: Undefined variable: "$alert-padding".
Run Code Online (Sandbox Code Playgroud)
在我之前的assets.rb文件中,我已经逐个文件地添加了每个资产,并且部署正在运行,但是,我正在布局文件中导入一些资产:
<%= javascript_include_tag 'application', 'jquery-ui-1.9.2', 'js-example', 'js-example2', 'data-turbolinks-track' => true %>
Run Code Online (Sandbox Code Playgroud)
但我也使用链轮导入一些:
//= require jquery
//= require bootstrap-sprockets
//= require angular
//= require jquery_ujs
//= require turbolinks
//= require_tree .
Run Code Online (Sandbox Code Playgroud)
这个方法在我开发应用程序时运行良好,但是当我将应用程序部署到生产环境时,似乎我使用链轮导入的东西没有被导入(即Angular)
提前致谢.
编辑:根据要求,我的application.css.scss文件:
/*
*
*= require_tree .
*= …Run Code Online (Sandbox Code Playgroud) 我有一个旧的 Angular 应用程序和一个新的 React 应用程序,我想通过 nginx 公开它们。
我有一个包含静态文件的生产 nginx 配置,但我试图让开发人员也能工作 - 使用热重载和 webpack 开发服务器。我已经按照它应该的方式工作了,但我意识到如果我可以使用 /r/ 来确定反应范围,并使用 /a/ 来确定角度应用程序,那就更好了。但是,使用下面的配置,每当我访问 时localhost/r/,bundle.js 都会位于 中/static/。有没有办法制作/static/反应/r/static/应用程序?
有更好的方法吗?
location /r {
proxy_pass http://172.17.0.2:3000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /static/ {
proxy_pass http://172.17.0.2:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /sockjs-node/ {
proxy_pass http://172.17.0.2:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 React Native 开始使用 Android,并且我正在尝试让入门项目 (AwesomeProject) 正常工作。我不断收到以下错误:
? AwesomeProject react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Exception in thread "main" java.io.FileNotFoundException: /Users/myusername/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip.lck (No such file or directory)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:49)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and …Run Code Online (Sandbox Code Playgroud) docker ×1
dockerfile ×1
ecmascript-6 ×1
ecmascript-7 ×1
email ×1
gmail ×1
gradle ×1
jasmine ×1
javascript ×1
jestjs ×1
nginx ×1
nvidia ×1
pyqt ×1
react-native ×1
reactjs ×1
ruby ×1