fix(specs): various fixes to get IE8+jquery unit tests green

This commit is contained in:
Igor Minar 2011-09-15 05:36:00 +02:00
parent 2170c06924
commit 7ae536d053
4 changed files with 24 additions and 7 deletions

View file

@ -597,7 +597,7 @@ describe('angular', function(){
describe('nodeName_', function() {
it('should correctly detect node name with "namespace" when xmlns is defined', function() {
var div = jqLite('<div xmlns:ngtest="http://angularjs.org/">' +
'<ngtest:foo ngtest:attr="bar"></ng:test>' +
'<ngtest:foo ngtest:attr="bar"></ngtest:foo>' +
'</div>')[0];
expect(nodeName_(div.childNodes[0])).toBe('NGTEST:FOO');
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');

View file

@ -74,7 +74,7 @@ describe('compiler', function(){
it('should observe scope', function(){
scope = compile('<span observe="name">');
scope = compile('<span observe="name"></span>');
expect(log).toEqual("");
scope.$digest();
scope.name = 'misko';

View file

@ -339,15 +339,26 @@ describe('jqLite', function(){
expect(jqLite(b).css('margin')).toEqual('3px');
selector.css('margin', '');
expect(jqLite(a).css('margin')).toBeFalsy();
expect(jqLite(b).css('margin')).toBeFalsy();
if (msie <= 8) {
expect(jqLite(a).css('margin')).toBe('auto');
expect(jqLite(b).css('margin')).toBe('auto');
} else {
expect(jqLite(a).css('margin')).toBeFalsy();
expect(jqLite(b).css('margin')).toBeFalsy();
}
});
it('should set a bunch of css properties specified via an object', function() {
expect(jqLite(a).css('margin')).toBeFalsy();
expect(jqLite(a).css('padding')).toBeFalsy();
expect(jqLite(a).css('border')).toBeFalsy();
if (msie <= 8) {
expect(jqLite(a).css('margin')).toBe('auto');
expect(jqLite(a).css('padding')).toBe('0px');
expect(jqLite(a).css('border')).toBeUndefined();
} else {
expect(jqLite(a).css('margin')).toBeFalsy();
expect(jqLite(a).css('padding')).toBeFalsy();
expect(jqLite(a).css('border')).toBeFalsy();
}
jqLite(a).css({'margin': '1px', 'padding': '2px', 'border': ''});

View file

@ -63,6 +63,11 @@ describe("markups", function(){
});
});
afterEach(function() {
if (element) element.remove();
});
it('should populate value attribute on OPTION', function(){
compile('<select name="x"><option>abc</option></select>');
expect(element).toHaveValue('abc');
@ -114,6 +119,7 @@ describe("markups", function(){
it('should bind selected', function() {
compile('<select><option value=""></option><option ng:selected="{{isSelected}}">Greetings!</option></select>');
jqLite(document.body).append(element)
scope.isSelected=false;
scope.$digest();
expect(element.children()[1].selected).toBeFalsy();