Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9d08b33

Browse files
test($route): ensure mock $sce delegate is implemented correctly
The mock calls to `valueOf(v)` and `getTrustedResourceUrl(v)` were not dealing with the case where `v` was null.
1 parent e13eeab commit 9d08b33

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/ngRoute/routeSpec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,10 @@ describe('$route', function() {
10281028
$routeProvider = _$routeProvider_;
10291029

10301030
$provide.decorator('$sce', function($delegate) {
1031+
function getVal(v) { return v.getVal ? v.getVal() : v; }
10311032
$delegate.trustAsResourceUrl = function(url) { return new MySafeResourceUrl(url); };
1032-
$delegate.getTrustedResourceUrl = function(v) { return v.getVal(); };
1033-
$delegate.valueOf = function(v) { return v.getVal(); };
1033+
$delegate.getTrustedResourceUrl = function(v) { return getVal(v); };
1034+
$delegate.valueOf = function(v) { return getVal(v); };
10341035
return $delegate;
10351036
});
10361037
});

0 commit comments

Comments
 (0)