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

Commit cce6662

Browse files
committed
fixup
- remove unused deps - clarify variables - simplify error expects
1 parent 0ff09f8 commit cce6662

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

test/ng/compileSpec.js

+14-16
Original file line numberDiff line numberDiff line change
@@ -1219,13 +1219,13 @@ describe('$compile', function() {
12191219
{
12201220
'no root element': 'dada',
12211221
'multiple root elements': '<div></div><div></div>'
1222-
}, function($prop) {
1222+
}, function(directiveTemplate) {
12231223

1224-
inject(function($compile, $templateCache, $rootScope) {
1225-
templateVar = $prop;
1224+
inject(function($compile) {
1225+
templateVar = directiveTemplate;
12261226
expect(function() {
12271227
$compile('<p template></p>');
1228-
}).toThrowMinErr('$compile', 'tplrt', 'Template for directive \'template\' must have exactly one root element.');
1228+
}).toThrowMinErr('$compile', 'tplrt');
12291229
});
12301230
});
12311231

@@ -1234,14 +1234,14 @@ describe('$compile', function() {
12341234
'whitespace': ' <div>Hello World!</div> \n',
12351235
'comments': '<!-- oh hi --><div>Hello World!</div> \n',
12361236
'comments + whitespace': ' <!-- oh hi --> <div>Hello World!</div> <!-- oh hi -->\n'
1237-
}, function($prop) {
1237+
}, function(directiveTemplate) {
12381238

1239-
inject(function($compile, $templateCache, $rootScope) {
1240-
templateVar = $prop;
1239+
inject(function($compile, $rootScope) {
1240+
templateVar = directiveTemplate;
12411241
var element;
12421242
expect(function() {
12431243
element = $compile('<p template></p>')($rootScope);
1244-
}).not.toThrowMinErr('$compile', 'tplrt', 'Template for directive \'template\' must have exactly one root element.');
1244+
}).not.toThrow();
12451245
expect(element.length).toBe(1);
12461246
expect(element.text()).toBe('Hello World!');
12471247
});
@@ -2067,15 +2067,14 @@ describe('$compile', function() {
20672067
{
20682068
'no root element': 'dada',
20692069
'multiple root elements': '<div></div><div></div>'
2070-
}, function($prop) {
2070+
}, function(directiveTemplate) {
20712071

20722072
inject(function($compile, $templateCache, $rootScope) {
2073-
// no root element
2074-
$templateCache.put('template.html', $prop);
2073+
$templateCache.put('template.html', directiveTemplate);
20752074
$compile('<p template></p>')($rootScope);
20762075
expect(function() {
20772076
$rootScope.$digest();
2078-
}).toThrowMinErr('$compile', 'tplrt', 'Template for directive \'template\' must have exactly one root element. template.html');
2077+
}).toThrowMinErr('$compile', 'tplrt');
20792078
});
20802079
});
20812080

@@ -2084,15 +2083,14 @@ describe('$compile', function() {
20842083
'whitespace': ' <div>Hello World!</div> \n',
20852084
'comments': '<!-- oh hi --><div>Hello World!</div> \n',
20862085
'comments + whitespace': ' <!-- oh hi --> <div>Hello World!</div> <!-- oh hi -->\n'
2087-
}, function($prop) {
2086+
}, function(directiveTemplate) {
20882087

20892088
inject(function($compile, $templateCache, $rootScope) {
2090-
// no root element
2091-
$templateCache.put('template.html', $prop);
2089+
$templateCache.put('template.html', directiveTemplate);
20922090
element = $compile('<p template></p>')($rootScope);
20932091
expect(function() {
20942092
$rootScope.$digest();
2095-
}).not.toThrowMinErr('$compile', 'tplrt', 'Template for directive \'template\' must have exactly one root element. template.html');
2093+
}).not.toThrow();
20962094
expect(element.length).toBe(1);
20972095
expect(element.text()).toBe('Hello World!');
20982096
});

0 commit comments

Comments
 (0)