Skip to content

Commit 3e98524

Browse files
fix(trace): Only trace when options.trace is true
fix(resolve): Update tests for default resolve policy JIT
1 parent 0d22bd8 commit 3e98524

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/resolve/resolvable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Resolvable {
7676
return this.promise;
7777
}).then(data => {
7878
this.data = data;
79-
trace.traceResolvableResolved(this, options);
79+
if (options.trace) trace.traceResolvableResolved(this, options);
8080
return this.promise;
8181
});
8282
}

test/resolveSpec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('Resolvables system:', function () {
114114

115115
it('should resolve only eager resolves when run with "eager" policy', inject(function ($q) {
116116
var path = makePath([ "J", "N" ]);
117-
var promise = path.elements[1].resolvePathElement(path, { policy: "eager" });
117+
var promise = path.elements[1].resolvePathElement(path, { resolvePolicy: "eager" });
118118
promise.then(function () {
119119
var results = map(path.getResolvables(), function(r) { return r.data; });
120120
expect(results).toEqualData({_J: "J", _N: "JN" });
@@ -127,7 +127,7 @@ describe('Resolvables system:', function () {
127127

128128
it('should resolve only eager and lazy resolves in PathElement when run with "lazy" policy', inject(function ($q) {
129129
var path = makePath([ "J", "N" ]);
130-
var promise = path.elements[1].resolvePathElement(path, { policy: "lazy" });
130+
var promise = path.elements[1].resolvePathElement(path, { resolvePolicy: "lazy" });
131131
promise.then(function () {
132132
expect(getResolvedData(path)).toEqualData({ _J: "J", _N: "JN", _N2: "JN2" });
133133
asyncCount++;
@@ -162,7 +162,7 @@ describe('Resolvables system:', function () {
162162

163163
it('should resolve only eager resolves when run with "eager" policy', inject(function ($q) {
164164
var path = makePath([ "J", "N" ]);
165-
var promise = path.resolvePath({ policy: "eager" });
165+
var promise = path.resolvePath({ resolvePolicy: "eager" });
166166
promise.then(function () {
167167
expect(getResolvedData(path)).toEqualData({ _J: "J", _N: "JN" });
168168
asyncCount++;
@@ -174,7 +174,7 @@ describe('Resolvables system:', function () {
174174

175175
it('should resolve only lazy and eager resolves when run with "lazy" policy', inject(function ($q) {
176176
var path = makePath([ "J", "N" ]);
177-
var promise = path.resolvePath({ policy: "lazy" });
177+
var promise = path.resolvePath({ resolvePolicy: "lazy" });
178178
promise.then(function () {
179179
expect(getResolvedData(path)).toEqualData({ _J: "J", _N: "JN", _N2: "JN2"});
180180
asyncCount++;
@@ -531,7 +531,7 @@ describe("State transitions with resolves", function() {
531531
it("should invoke jit resolves when they are injected", inject(function() {
532532
statesMap.J.controller = function JController(_J) { };
533533

534-
testGo("J", {}, {trace: true});
534+
testGo("J");
535535
expectCounts._J++;
536536
expect(counts).toEqualData(expectCounts);
537537
}));
@@ -550,7 +550,7 @@ describe("State transitions with resolves", function() {
550550
}));
551551

552552
it("should not re-invoke jit resolves", inject(function() {
553-
statesMap.J.controller = function KController(_J) { };
553+
statesMap.J.controller = function JController(_J) { };
554554
statesMap.K.controller = function KController(_K) { };
555555
testGo("J");
556556
expectCounts._J++;
@@ -565,7 +565,7 @@ describe("State transitions with resolves", function() {
565565

566566
it("should invoke jit resolves during a transition that are injected in a hook like onEnter", inject(function() {
567567
statesMap.J.onEnter = function onEnter(_J) {};
568-
testGo("J", {}, { trace: true });
568+
testGo("J");
569569
expectCounts._J++;
570570
expect(counts).toEqualData(expectCounts);
571571
}));

test/stateSpec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ describe('state', function () {
306306
badness: function($q) {
307307
return $q.reject("!");
308308
}
309-
}
309+
},
310+
onEnter: function(badness) {}
310311
})
311312
.state('resolveTimeout', {
312313
url: "/:foo",
@@ -315,6 +316,7 @@ describe('state', function () {
315316
return $timeout(function() { log += "Success!"; }, 1);
316317
}
317318
},
319+
onEnter: function(value) {},
318320
template: "-",
319321
controller: function() { log += "controller;"}
320322
})

0 commit comments

Comments
 (0)