aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive')
-rw-r--r--test/ng/directive/formSpec.js12
-rw-r--r--test/ng/directive/ngRepeatSpec.js8
-rw-r--r--test/ng/directive/selectSpec.js10
3 files changed, 30 insertions, 0 deletions
diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js
index fb64fdb3..53fd3d90 100644
--- a/test/ng/directive/formSpec.js
+++ b/test/ng/directive/formSpec.js
@@ -137,6 +137,18 @@ describe('form', function() {
});
+ it('should throw an exception if an input has name="hasOwnProperty"', function() {
+ doc = jqLite(
+ '<form name="form">'+
+ '<input name="hasOwnProperty" ng-model="some" />'+
+ '<input name="other" ng-model="someOther" />'+
+ '</form>');
+ expect(function() {
+ $compile(doc)(scope);
+ }).toThrowMinErr('ng', 'badname');
+ });
+
+
describe('preventing default submission', function() {
it('should prevent form submission', function() {
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js
index 72035566..4cf79dbf 100644
--- a/test/ng/directive/ngRepeatSpec.js
+++ b/test/ng/directive/ngRepeatSpec.js
@@ -137,6 +137,14 @@ describe('ngRepeat', function() {
});
+ it("should throw an exception if 'track by' evaluates to 'hasOwnProperty'", function() {
+ scope.items = {age:20};
+ $compile('<div ng-repeat="(key, value) in items track by \'hasOwnProperty\'"></div>')(scope);
+ scope.$digest();
+ expect($exceptionHandler.errors.shift().message).toMatch(/ng:badname/);
+ });
+
+
it('should track using build in $id function', function() {
element = $compile(
'<ul>' +
diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js
index 584fe614..85acba19 100644
--- a/test/ng/directive/selectSpec.js
+++ b/test/ng/directive/selectSpec.js
@@ -1247,5 +1247,15 @@ describe('select', function() {
expect(element.find('span').text()).toBe('success');
dealoc(element);
}));
+
+ it('should throw an exception if an option value interpolates to "hasOwnProperty"', function() {
+ scope.hasOwnPropertyOption = "hasOwnProperty";
+ expect(function() {
+ compile('<select ng-model="x">'+
+ '<option>{{hasOwnPropertyOption}}</option>'+
+ '</select>');
+ }).toThrowMinErr('ng','badname', 'hasOwnProperty is not a valid "option value" name');
+ });
+
});
});