Skip to content

Commit 2170c06

Browse files
committed
fix(specs): fix jQuery to jqLite binding on IE8
It appears that this whole time all IE8 unit tests ran only with jqLite. Due to a weird bug in IE[1], we never overwrote jqLite implementation with jQuery, so the tests ran with our jqLite instead. This affected only IE8 (and likely older) and only in unit testing mode. angular.js - the built artifact binds to jQuery just find. [1] https://plus.google.com/104744871076396904202/posts/Kqjuj6RSbbT
1 parent 0e5a24c commit 2170c06

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

test/jqLiteSpec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ describe('jqLite', function(){
3939
});
4040

4141

42+
it('should be jqLite when jqLiteMode is on, otherwise jQuery', function() {
43+
expect(jqLite).toBe(_jqLiteMode ? jqLiteWrap : _jQuery);
44+
});
45+
46+
4247
describe('construction', function(){
4348
it('should allow construction with text node', function(){
4449
var text = a.firstChild;

test/jquery_alias.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
'use strict';
22

3-
var _jQuery = jQuery;
3+
var _jQuery = jQuery,
4+
_jqLiteMode = false;

test/jquery_remove.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
'use strict';
22

3-
var _jQuery = jQuery.noConflict(true);
3+
var _jQuery = jQuery.noConflict(true),
4+
_jqLiteMode = true;

test/testabilityPatch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ if (window.jstestdriver) {
2828
beforeEach(function(){
2929
// This is to reset parsers global cache of expressions.
3030
compileCache = {};
31+
32+
// workaround for IE bug https://plus.google.com/104744871076396904202/posts/Kqjuj6RSbbT
33+
// IE overwrite window.jQuery with undefined because of empty jQuery var statement, so we have to
34+
// correct this, but only if we are not running in jqLite mode
35+
if (!_jqLiteMode && _jQuery !== jQuery) {
36+
jQuery = _jQuery;
37+
}
38+
3139
// reset to jQuery or default to us.
3240
bindJQuery();
3341
jqLite(document.body).html('');

0 commit comments

Comments
 (0)