aboutsummaryrefslogtreecommitdiffstats
path: root/test/markupSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/markupSpec.js')
-rw-r--r--test/markupSpec.js35
1 files changed, 18 insertions, 17 deletions
diff --git a/test/markupSpec.js b/test/markupSpec.js
index ce44d88c..ab8b4c74 100644
--- a/test/markupSpec.js
+++ b/test/markupSpec.js
@@ -20,24 +20,25 @@ describe("markups", function(){
it('should translate {{}} in text', function(){
compile('<div>hello {{name}}!</div>');
expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name"></span>!</div>');
- scope.$set('name', 'Misko');
- scope.$eval();
+ scope.name = 'Misko';
+ scope.$flush();
expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name">Misko</span>!</div>');
});
it('should translate {{}} in terminal nodes', function(){
compile('<select name="x"><option value="">Greet {{name}}!</option></select>');
+ scope.$flush();
expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng:bind-template="Greet {{name}}!">Greet !</option></select>');
- scope.$set('name', 'Misko');
- scope.$eval();
+ scope.name = 'Misko';
+ scope.$flush();
expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng:bind-template="Greet {{name}}!">Greet Misko!</option></select>');
});
it('should translate {{}} in attributes', function(){
compile('<div src="http://server/{{path}}.png"/>');
expect(element.attr('ng:bind-attr')).toEqual('{"src":"http://server/{{path}}.png"}');
- scope.$set('path', 'a/b');
- scope.$eval();
+ scope.path = 'a/b';
+ scope.$flush();
expect(element.attr('src')).toEqual("http://server/a/b.png");
});
@@ -94,57 +95,57 @@ describe("markups", function(){
it('should bind disabled', function() {
compile('<button ng:disabled="{{isDisabled}}">Button</button>');
scope.isDisabled = false;
- scope.$eval();
+ scope.$flush();
expect(element.attr('disabled')).toBeFalsy();
scope.isDisabled = true;
- scope.$eval();
+ scope.$flush();
expect(element.attr('disabled')).toBeTruthy();
});
it('should bind checked', function() {
compile('<input type="checkbox" ng:checked="{{isChecked}}" />');
scope.isChecked = false;
- scope.$eval();
+ scope.$flush();
expect(element.attr('checked')).toBeFalsy();
scope.isChecked=true;
- scope.$eval();
+ scope.$flush();
expect(element.attr('checked')).toBeTruthy();
});
it('should bind selected', function() {
compile('<select><option value=""></option><option ng:selected="{{isSelected}}">Greetings!</option></select>');
scope.isSelected=false;
- scope.$eval();
+ scope.$flush();
expect(element.children()[1].selected).toBeFalsy();
scope.isSelected=true;
- scope.$eval();
+ scope.$flush();
expect(element.children()[1].selected).toBeTruthy();
});
it('should bind readonly', function() {
compile('<input type="text" ng:readonly="{{isReadonly}}" />');
scope.isReadonly=false;
- scope.$eval();
+ scope.$flush();
expect(element.attr('readOnly')).toBeFalsy();
scope.isReadonly=true;
- scope.$eval();
+ scope.$flush();
expect(element.attr('readOnly')).toBeTruthy();
});
it('should bind multiple', function() {
compile('<select ng:multiple="{{isMultiple}}"></select>');
scope.isMultiple=false;
- scope.$eval();
+ scope.$flush();
expect(element.attr('multiple')).toBeFalsy();
scope.isMultiple='multiple';
- scope.$eval();
+ scope.$flush();
expect(element.attr('multiple')).toBeTruthy();
});
it('should bind src', function() {
compile('<div ng:src="{{url}}" />');
scope.url = 'http://localhost/';
- scope.$eval();
+ scope.$flush();
expect(element.attr('src')).toEqual('http://localhost/');
});