jasmine专题提供jasmine的最新资讯内容,帮你更好的了解jasmine。
我有一个看起来像这样的指令: angular.directive('newDirective', ['$compile', function($compile){ return { link: function(scope, element, attr, controller) { console.log("newDirective Content:
在查询$httpBackend后我似乎无法返回预期的结果,我不知道测试有什么问题.你能看看这个失败的最小例子吗? 链接演示 http://jsfiddle.net/paos/kTNF5/ 茉莉花输出 query() Expected [ ] to equal [ { hello : 'world' } ]. 码 依赖资源 <script src="https://raw.github.com/pi
我正在使用茉莉来测试我在TypeScript中编写的控制器.我的单元测试是用普通的 javascript. 当我测试我的控制器时,我收到一个错误,我想注入一个模拟服务. 这是我的测试看起来的样子: 'use strict'; describe('ConfigCtrl', function(){ var scope, http, location, timeout, $httpBacken
我有角度模块: var app = angular.module("SearchUI",[]); 在它,我有一个服务“configService”,维护一堆配置参数: app.provider("configService",function(){ //stuff here }) 我在configService fineL中运行了jasmine单元测试 describe('configServ
我在Jasmine和Karma中有很多依赖于$httpBackend HTTP模拟检查的测试.当我今天升级Angular时,他们停止了工作. 假设我的Jasmine测试中有这样的东西: // Arrange httpBackend.expect('POST', 'https://localhost:44300/api/projects/1/samples').respond(fakedDt
我写了Protractor自动化测试并面临一个问题. Wait command实际上并没有等待其中一个数组元素.请参阅下面的示例:我尝试在导航到网页后等待第一个元素. var category = element.all(by.repeater('category in listCtrl.categories')); var category2 = $$('.category-name.custo
我按如下方式定义了一个FooService import {Injectable} from "@angular/core"; export interface Foo { Foo(): string; } @Injectable() export class FooService implements Foo { Foo(): string { return "
我正在实施离子应用程序的单元测试,需要检查$rootScope上没有广播任何事件 expect($rootScope.$broadcast).not.toHaveBeenCalled(); 问题是有时会广播$locationChangeStart和$locationChangeSuccess事件,这会使我的测试失败.似乎离子v1.3.0触发了以下代码中的那些 // update browser $
在 angular docs的指令部分 它们大致提供了如何制作拖动物的示例. 我的问题是你如何测试他们的例子/实施: var startX = 0, startY = 0; scope.x = 0; scope.y = 0; element.css({ top: scope.y, left: scope.x }); element.on('mousedown
如何在Angular 2中模拟函数的click事件?对于我的Home组件,我有: 家庭组件 import { Component } from '@angular/core'; import { Router } from '@angular/router'; @Component({ moduleId: module.id, templateUrl: 'home.component.h
我正在寻找一种从量角器的全部返回值数组的简单方法.(by.repeater) 基本上,我只想要一个简单的方法来创建一个用户名数组,给用户中的转发器. 现在我正在构建它: allUsers = element.all(by.repeater('user in users').column('user.username')).then(function(array){ var results =
import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; @Com(I)ponent({ selector: 'app-fruit-cake',(E) templateUrl: './fruit-cake.component.html',
我有以下茉莉花测试: it('should resolve promise', inject(function ($q, $rootScope) { function getPromise(){ var deferred = $q.defer(); setTimeout(function(){ deferred.resolve(tr
我想用茉莉花测试“点击”事件,但我不知道如何 我的指令文件就是这样(headbarDirective.js): (function () { angular.module('app.widgets.homeHeadbar',[]) .directive('homeHeadbar', homeHeadbar); function homeHe
这是我的控制器: export class testController { static $inject: string[] = ["testService", "$mdDialog", "$state"]; constructor(public _testService: services.testService, private _mdDialog: any, privat
我试图单元测试一个简单的指令,但范围中的变量总是未定义的. 指令Src代码: .directive('ratingButton', ['$rootScope', function($rootScope) { return { restrict: "E", replace: true, template: '<button
Testacular(现在的Karma)很棒,角度场景也是如此.将它们合在一起证明是一个挑战.在Testacular中有一个ANGULAR-SCENARIO-ADAPTER,但是这样就可以打破简单的测试.如果你自己包括angular-scenario.js,Testacular将不会执行任何测试.有没有人正确运行这个? 角情景ADAPTER 我试图用这个微不足道的测试,但是我看到一些奇怪的行为:
在使用AngularJS构建单个页面应用程序的同时,我试图在我的构建中集成Jasmine测试. 我之前使用Maven Jasmine插件做了类似的工作,但是我不喜欢在maven中包装我的项目来运行Jasmine测试.使用Karma(被称为Testacular)看起来更清楚了. 我很舒服,我会从shell命令运行的东西,我的猜测是,然后我可以从竹子运行命令. 我的问题: 我在正确的轨道上吗? >我如
我正在使用茉莉花编写一个角度应用程序的测试用例.但是,许多内部方法在服务中被声明为私有的. 例: App.service('productDisplay', function(){ var myPrivate = function(){ //do sth } this.doOfferCal = function(product, date){
我有一个单元测试,其中唯一的期望是发出http呼叫.我为此使用$httpBackend.expect().这样工作正常,单元测试失败,如果这个http请求没有(这是好的),并通过,如果http请求. 问题在于,即使想到这一点,茉莉花规范竞赛者对这个单元测试显示“SPEC HAS NO EXPECTATIONS”,这使我觉得我没有使用推荐的方式来测试一个http的呼叫.如何避免看到此讯息? 示例测试