aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2011-05-06 13:29:51 -0700
committerMisko Hevery2011-06-08 15:21:33 -0700
commit04a62e83bcd4067749fa5e2eb0181bc43500169c (patch)
treef8cd732f1ed44bd18308c4393c893e39190e9735 /test
parentf9f95879f08073ce1170a471a925541324a0ff23 (diff)
downloadangular.js-04a62e83bcd4067749fa5e2eb0181bc43500169c.tar.bz2
Throw error when compiling multiple roots
Closes #338
Diffstat (limited to 'test')
-rw-r--r--test/BinderSpec.js4
-rw-r--r--test/CompilerSpec.js9
-rw-r--r--test/service/invalidWidgetsSpec.js2
3 files changed, 12 insertions, 3 deletions
diff --git a/test/BinderSpec.js b/test/BinderSpec.js
index 15a1b5c7..d78573bb 100644
--- a/test/BinderSpec.js
+++ b/test/BinderSpec.js
@@ -40,8 +40,8 @@ describe('Binder', function(){
});
it('ChangingRadioUpdatesModel', function(){
- var scope = this.compile('<input type="radio" name="model.price" value="A" checked>' +
- '<input type="radio" name="model.price" value="B">');
+ var scope = this.compile('<div><input type="radio" name="model.price" value="A" checked>' +
+ '<input type="radio" name="model.price" value="B"></div>');
scope.$eval();
assertEquals(scope.model.price, 'A');
});
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js
index b9505192..ff576581 100644
--- a/test/CompilerSpec.js
+++ b/test/CompilerSpec.js
@@ -35,6 +35,15 @@ describe('compiler', function(){
dealoc(scope);
});
+ it('should not allow compilation of multiple roots', function(){
+ expect(function(){
+ compiler.compile('<div>A</div><span></span>');
+ }).toThrow("Cannot compile multiple element roots: " + ie("<div>A</div><span></span>"));
+ function ie(text) {
+ return msie ? uppercase(text) : text;
+ }
+ });
+
it('should recognize a directive', function(){
var e = jqLite('<div directive="expr" ignore="me"></div>');
directives.directive = function(expression, element){
diff --git a/test/service/invalidWidgetsSpec.js b/test/service/invalidWidgetsSpec.js
index 4bf16a6e..6b965ef8 100644
--- a/test/service/invalidWidgetsSpec.js
+++ b/test/service/invalidWidgetsSpec.js
@@ -12,7 +12,7 @@ describe('$invalidWidgets', function() {
it("should count number of invalid widgets", function(){
- var element = jqLite('<input name="price" ng:required ng:validate="number"></input>');
+ var element = jqLite('<input name="price" ng:required ng:validate="number">');
jqLite(document.body).append(element);
scope = compile(element)();
var $invalidWidgets = scope.$service('$invalidWidgets');