我正在使用angular full stack进行开发,我的karma.conf.js文件是
files: [
'app/bower_components/jquery/jquery.js',
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/angular-cookies/angular-cookies.js',
'app/bower_components/angular-resource/angular-resource.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-sanitize/angular-sanitize.js',
'app/bower_components/angular-scenario/angular-scenario.js',
'app/scripts/controllers/*.js',
'app/scripts/directives/*.js',
'app/scripts/services/*.js',
'app/scripts/app.js',
'lib/routes.js',
'test/karma/unit/**/test.spec.js'
],
Run Code Online (Sandbox Code Playgroud)
测试规格:
'use strict';
(function() {
describe('App', function() {
describe('TestController', function() {
beforeEach(function() {
this.addMatchers({
toEqualData: function(expected) {
return angular.equals(this.actual, expected);
}
});
});
// Load the controllers module
beforeEach(module('ratefastApp'));
// Initialize the controller and a mock scope
var TestController,
mockUserResource,
scope,
$httpBackend,
$routeParams,
$location;
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
// This allows us to …Run Code Online (Sandbox Code Playgroud) 如何使 x 轴上的 pointInterval 在 x 轴与其本身之间有一些空间,因为在我的情况下,pointInterval 是旋转的,它是连接到 x 轴的一些内容。我尝试添加填充但徒劳。
labels: {
rotation: (chartType == 3 ? 0 : -60),
align: 'right',
style: {
fontSize: '14px',
fontFamily: 'proxima-nova,helvetica,arial,sans-seri',
whiteSpace: 'nowrap',
padding:'[100px 100px 100px 100px]'
}
}
Run Code Online (Sandbox Code Playgroud) 如何检查数组是否包含重复的字符串,我有validateArray = ['sa','sa','yu']我使用了SO中的以下函数,但同样不适用于我.
checkDuplicate = function (reportRecipients) {
if (reportRecipients.length > 1) {
var recipientsArray = reportRecipients.toString().split(',');
for (a in recipientsArray) {
if(reportRecipients.indexOf(a) != reportRecipients.lastIndexOf(a)){
return true;
break;
}
}
}
return false;
}
Run Code Online (Sandbox Code Playgroud)