我注意到,如果我编写expect expect(null).toBeDefined();,测试就会通过,因为茉莉花认为null是一个已定义但没有任何值的对象。
我的问题是,是否有一个匹配器可以同时评估对象undefined是否不同。null
我有以下组件:
// Typescript
@Component({
selector: 'form-button',
templateUrl: './form-button.component.html',
styleUrls: ['./form-button.component.scss']
})
export class FormButtonComponent {}
//form-button.component.html
<div class="form-button-wrapper">
<div class="content"></div>
</div>
//form-button.component.scss
.form-button-wrapper {
width: 100%;
height: 100%
}
Run Code Online (Sandbox Code Playgroud)
在 html 中,将如下所示:
<head>...</head>
<body>
....
<form-button>
<div class="form-button-wrapper">
<div class="content"></div>
</div>
</form-button>
....
</body>
Run Code Online (Sandbox Code Playgroud)
我希望 t 定义宽度和重量,<form-button>而不是在 中<div class="form-button-wrapper">。
我怎样才能做到这一点?
我正在使用这个插件http://iamceege.github.io/tooltipster/.
有可能知道HTML是否已经初始化了工具提示器?
我想知道,因为有时我需要更改工具提示的文本,为此,我需要销毁工具提示器,更改HTML对象的属性标题,然后再次初始化.像这样:
$(this).tooltipster('destroy').attr("title", data.fields[i].value).tooltipster();
Run Code Online (Sandbox Code Playgroud) 我正在使用静态方法创建一个静态类,以帮助控制器完成他们的工作.构建应用程序时,我收到以下错误:
System.Web.Mvc.Controller.Content(string)由于其保护级别错误40' '无法访问
知道如何解决这个问题吗?
注意:这是ac#mvc aplication
public static ActionResult GetAlbumJSON(AlbumVO album)
{
return Controller.Content(
JsonConvert.SerializeObject(new
{
max_car = @ABookClient.maxCharsProjecName,
trans_img = @ABookClient.Transparent_Image,
show_description = @ABookClient.Show_Product_Description,
product_type = "Album",
obj = CreateObjAlbumVO(album),
})
);
}
Run Code Online (Sandbox Code Playgroud) 我正在从角度5迁移到角度6.当我进行npm运行构建时,我是向控制台抛出以下错误:
错误TS2305:模块"'C:/PrjNET/Elevation3/FW/4.00/Mainline/Framework/Development/Client/ElevationJS/ngcore/.tmp/node_modules/rxjs/operator/map’"不具有出口构件"地图".
我输入map如下:
import { map} from 'rxjs/operator/map';
Run Code Online (Sandbox Code Playgroud)
谁知道如何解决这个问题?
我正在使用谷歌的mobilenet神经网络对图像进行分类。我正在使用 Angular 6 + TensorFlow.js 构建我的图像分类器应用程序。
我尝试按照tfjs-converter 库自述文件提供的步骤进行操作,并得出以下代码:
import * as tf from '@tensorflow/tfjs';
import { FrozenModel } from '@tensorflow/tfjs';
export class NeuralNetwork {
private MODEL_PATH: string = 'http://localhost:4200/assets/model/tensorflowjs_model.pb';
private WEIGHTS_PATH: string = 'http://localhost:4200/assets/model/weights_manifest.json';
constructor(){}
async loadModel() {
const localModel: FrozenModel = (await tf.loadFrozenModel(this.MODEL_PATH, this.WEIGHTS_PATH));
let image: any = document.getElementById('cat');
let pixels = tf.fromPixels(image, 1);
let result = localModel.predict(pixels);
}
async predict(){
let image: any = document.getElementById('cat');
debugger;
this.model.execute({input: tf.fromPixels(image)});
}
}
Run Code Online (Sandbox Code Playgroud)
图像 HTML 元素:
<img …Run Code Online (Sandbox Code Playgroud) 我有一个 angular 6 应用程序,我正在使用 karma + jasmine 来运行我的测试。但是当我运行时,ng test我收到以下错误:
错误 TS2688 中的错误:找不到“jest”的类型定义文件。
有谁知道如何解决这个问题?
我在我的angular 6应用程序中使用了业力+茉莉花,并且收到以下警告:
DEPRECATION:','不建议在Env上直接设置specFilter,请在configure中使用specFilter选项'
我应该怎么做才能解决此警告?
我正在尝试使用 stub 类实例,sinon.createStubInstance但我收到一个错误,指出缺少私有成员变量。当然我也不能明确设置它,因为它是一个私有成员。
示例类:
class Foo {
private readonly bar: string;
constructor(bar: string) {
this.bar = bar;
}
}
class Parent {
foos: Foo[];
constructor(foos: Foo[]) {
this.foos = foos;
}
}
Run Code Online (Sandbox Code Playgroud)
在测试中,我正在编写一个beforeEach块:
beforeEach(function () {
const stubFoo = sinon.createStubInstance(Foo);
const stubParent = sinon.createStubInstance(Parent);
stubParent.foos = [stubFoo]; // Tslint error here
});
Run Code Online (Sandbox Code Playgroud)
Tslint 错误是:
“SinonStubbedInstance”类型中缺少属性“bar”,但“Foo”类型中需要
作为记录,我使用的是 Typescript v3.0.3 和 Sinon v7.4.1。
我正在尝试使用 github 操作部署我的 firebase 云功能应用程序:
name: Deploy
'on':
push:
branches:
- main
jobs:
deploy_to_production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: cd functions/ && npm install
- name: deploy to production
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
“部署到生产”步骤未成功。我激活调试模式,但实际上没有收到任何有用的信息:
##[debug]Evaluating: secrets.FIREBASE_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'FIREBASE_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'deploy to production'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: …Run Code Online (Sandbox Code Playgroud) angular ×4
typescript ×4
jasmine ×3
javascript ×3
angular6 ×2
css ×2
karma-runner ×2
angular-cli ×1
asp.net-mvc ×1
c# ×1
firebase ×1
github ×1
html ×1
jquery ×1
rxjs6 ×1
sass ×1
sinon ×1
stub ×1
tensorflow ×1
tooltipster ×1
unit-testing ×1