aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngRoute/directive/ngViewSpec.js
diff options
context:
space:
mode:
authorIgor Minar2013-09-20 10:50:10 -0700
committerIgor Minar2013-09-20 13:55:16 -0700
commit255e8c13cf0fd78f1c4d7c279be7bf47c2402956 (patch)
tree8dbf9430b809552bb1c9a506dc0be9a697383db4 /test/ngRoute/directive/ngViewSpec.js
parent88317a2888b742894c7942896dc038159f8e1afb (diff)
downloadangular.js-255e8c13cf0fd78f1c4d7c279be7bf47c2402956.tar.bz2
fix(ngView): IE8 regression due to expando on non-element nodes
This fixes the "TypeError: Object doesn't support this property or method" error on IE8, when view templates contain leading white-space. Closes #3971
Diffstat (limited to 'test/ngRoute/directive/ngViewSpec.js')
-rw-r--r--test/ngRoute/directive/ngViewSpec.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js
index d354a355..d38b3ba9 100644
--- a/test/ngRoute/directive/ngViewSpec.js
+++ b/test/ngRoute/directive/ngViewSpec.js
@@ -455,7 +455,7 @@ describe('ngView', function() {
});
- it('should set $scope and $controllerController on the view', function() {
+ it('should set $scope and $controllerController on the view elements (except for non-element nodes)', function() {
function MyCtrl($scope) {
$scope.state = 'WORKS';
$scope.ctrl = this;
@@ -466,11 +466,14 @@ describe('ngView', function() {
});
inject(function($templateCache, $location, $rootScope, $route) {
- $templateCache.put('tpl.html', [200, '<div>{{state}}</div>', {}]);
+ // in the template the white-space before the div is an intentional non-element node,
+ // a text might get wrapped into span so it's safer to just use white space
+ $templateCache.put('tpl.html', [200, ' \n <div>{{state}}</div>', {}]);
$location.url('/foo');
$rootScope.$digest();
- expect(element.text()).toEqual('WORKS');
+ // using toMatch because in IE8+jquery the space doesn't get preserved. jquery bug?
+ expect(element.text()).toMatch(/\s*WORKS/);
var div = element.find('div');
expect(div.parent()[0].nodeName.toUpperCase()).toBeOneOf('NG:VIEW', 'VIEW');