Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ae536d

Browse files
committed
fix(specs): various fixes to get IE8+jquery unit tests green
1 parent 2170c06 commit 7ae536d

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

test/AngularSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ describe('angular', function(){
597597
describe('nodeName_', function() {
598598
it('should correctly detect node name with "namespace" when xmlns is defined', function() {
599599
var div = jqLite('<div xmlns:ngtest="http://angularjs.org/">' +
600-
'<ngtest:foo ngtest:attr="bar"></ng:test>' +
600+
'<ngtest:foo ngtest:attr="bar"></ngtest:foo>' +
601601
'</div>')[0];
602602
expect(nodeName_(div.childNodes[0])).toBe('NGTEST:FOO');
603603
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');

test/CompilerSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('compiler', function(){
7474

7575

7676
it('should observe scope', function(){
77-
scope = compile('<span observe="name">');
77+
scope = compile('<span observe="name"></span>');
7878
expect(log).toEqual("");
7979
scope.$digest();
8080
scope.name = 'misko';

test/jqLiteSpec.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,26 @@ describe('jqLite', function(){
339339
expect(jqLite(b).css('margin')).toEqual('3px');
340340

341341
selector.css('margin', '');
342-
expect(jqLite(a).css('margin')).toBeFalsy();
343-
expect(jqLite(b).css('margin')).toBeFalsy();
342+
if (msie <= 8) {
343+
expect(jqLite(a).css('margin')).toBe('auto');
344+
expect(jqLite(b).css('margin')).toBe('auto');
345+
} else {
346+
expect(jqLite(a).css('margin')).toBeFalsy();
347+
expect(jqLite(b).css('margin')).toBeFalsy();
348+
}
344349
});
345350

346351

347352
it('should set a bunch of css properties specified via an object', function() {
348-
expect(jqLite(a).css('margin')).toBeFalsy();
349-
expect(jqLite(a).css('padding')).toBeFalsy();
350-
expect(jqLite(a).css('border')).toBeFalsy();
353+
if (msie <= 8) {
354+
expect(jqLite(a).css('margin')).toBe('auto');
355+
expect(jqLite(a).css('padding')).toBe('0px');
356+
expect(jqLite(a).css('border')).toBeUndefined();
357+
} else {
358+
expect(jqLite(a).css('margin')).toBeFalsy();
359+
expect(jqLite(a).css('padding')).toBeFalsy();
360+
expect(jqLite(a).css('border')).toBeFalsy();
361+
}
351362

352363
jqLite(a).css({'margin': '1px', 'padding': '2px', 'border': ''});
353364

test/markupSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ describe("markups", function(){
6363
});
6464
});
6565

66+
afterEach(function() {
67+
if (element) element.remove();
68+
});
69+
70+
6671
it('should populate value attribute on OPTION', function(){
6772
compile('<select name="x"><option>abc</option></select>');
6873
expect(element).toHaveValue('abc');
@@ -114,6 +119,7 @@ describe("markups", function(){
114119

115120
it('should bind selected', function() {
116121
compile('<select><option value=""></option><option ng:selected="{{isSelected}}">Greetings!</option></select>');
122+
jqLite(document.body).append(element)
117123
scope.isSelected=false;
118124
scope.$digest();
119125
expect(element.children()[1].selected).toBeFalsy();

0 commit comments

Comments
 (0)