forked from mgcrea/angular-strap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.js
More file actions
61 lines (58 loc) · 1.64 KB
/
helpers.js
File metadata and controls
61 lines (58 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'use strict';
beforeEach(function() {
jasmine.addMatchers({
toEquals: function(util, customEqualityTesters) {
return {
compare: function(actual, expected) {
var result = {};
result.pass = angular.equals(actual, expected);
result.message = 'Expected "' + angular.mock.dump(actual) + '" to equal "' + angular.mock.dump(expected) + '".';
return result;
}
};
},
toHaveClass: function(util, customEqualityTesters) {
return {
compare: function(actual, expected) {
var result = {};
result.pass = actual.hasClass(expected);
result.message = 'Expected "' + angular.mock.dump(actual) + '" to have class "' + expected + '".';
return result;
}
};
}
});
});
/*
* Counts the number of scopes beginning with the
* passed in scope s.
* It counts scopes recursively by traversing each
* of the child scopes.
*
* returns the number of scopes found
*
* s -> scope to begin with
* count -> current scope count, should begin with 0
*/
function countScopes(s, count) {
if (s !== null) {
s = s.$$childHead;
while (s !== null) {
count = countScopes(s, count);
s = s.$$nextSibling;
}
}
return ++count;
}
function d() {
var args = Array.prototype.slice.call(arguments);
var time = new Date().toISOString();
console.log(time + ' - ' + 'break' + ': ' + console.log.call(console, args.length === 1 ? args[0] : args, false, 10, true));
}
function dd() {
d.apply(null, arguments);
var stack = new Error().stack.split('\n');
stack.splice(1, 1);
console.log(stack.join('\n'));
process.exit(1);
}