aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/markupSpec.js11
-rw-r--r--test/widgetsSpec.js21
2 files changed, 29 insertions, 3 deletions
diff --git a/test/markupSpec.js b/test/markupSpec.js
index 9e89af7b..8ea88f08 100644
--- a/test/markupSpec.js
+++ b/test/markupSpec.js
@@ -30,11 +30,11 @@ describe("markups", function(){
});
it('should translate {{}} in terminal nodes', function(){
- compile('<select><option>Greet {{name}}!</option></select>');
- expect(element.html()).toEqual('<option ng-bind-template="Greet {{name}}!"></option>');
+ compile('<select name="x"><option value="">Greet {{name}}!</option></select>');
+ expect(element.html()).toEqual('<option ng-bind-template="Greet {{name}}!" value=""></option>');
scope.set('name', 'Misko');
scope.updateView();
- expect(element.html()).toEqual('<option ng-bind-template="Greet {{name}}!">Greet Misko!</option>');
+ expect(element.html()).toEqual('<option ng-bind-template="Greet {{name}}!" value="">Greet Misko!</option>');
});
it('should translate {{}} in attributes', function(){
@@ -46,4 +46,9 @@ describe("markups", function(){
expect(element.attr('src')).toEqual("http://server/a/b.png");
});
+ it('should populate value attribute on OPTION', function(){
+ compile('<select name="x"><option>A</option></select>');
+ expect(element.html()).toEqual('<option value="A">A</option>');
+ });
+
});
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index 44a3d225..9471a718 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -108,6 +108,12 @@ describe("input widget", function(){
expect(scope.get('clicked')).toEqual(true);
});
+ it('should support button alias', function(){
+ compile('<button ng-action="clicked = true">Click Me</button>');
+ element.click();
+ expect(scope.get('clicked')).toEqual(true);
+ });
+
it('should type="checkbox"', function(){
compile('<input type="checkbox" name="checkbox" checked ng-action="action = true"/>');
expect(scope.get('checkbox')).toEqual(true);
@@ -142,6 +148,21 @@ describe("input widget", function(){
expect(model.clicked).toEqual(1);
});
+ it('should type="radio"', function(){
+ compile(
+ '<select name="selection">' +
+ '<option>A</option>' +
+ '<option selected>B</option>' +
+ '</select>');
+ expect(element[0].selectedIndex).toEqual(1);
+ expect(element[0].value).toEqual('B');
+ expect(model.selection).toEqual('B');
+ model.selection = 'A';
+ model.$updateView();
+ expect(model.selection).toEqual('A');
+ expect(element[0].childNodes[0].selected).toEqual(true);
+ });
+
it('should report error on missing field', function(){
});