Skip to content

Commit ccdcedd

Browse files
committed
Datepicker tests: Work around encoding issues in oldIE.
1 parent 8c36603 commit ccdcedd

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

tests/unit/datepicker/datepicker_events.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,21 @@ test('beforeShowDay-getDate', function() {
132132
dp = $('#ui-datepicker-div');
133133
inp.val('01/01/2010').datepicker('show');
134134
// contains non-breaking space
135-
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
135+
equal($('div.ui-datepicker-title').text(),
136+
// support: IE <9, jQuery <1.8
137+
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
138+
$( "<span>January&#xa0;2010</span>" ).text(), 'Initial month');
136139
$('a.ui-datepicker-next', dp).click();
137140
$('a.ui-datepicker-next', dp).click();
138141
// contains non-breaking space
139-
equal($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks');
142+
equal($('div.ui-datepicker-title').text(),
143+
$( "<span>March&#xa0;2010</span>" ).text(), 'After next clicks');
140144
inp.datepicker('hide').datepicker('show');
141145
$('a.ui-datepicker-prev', dp).click();
142146
$('a.ui-datepicker-prev', dp).click();
143147
// contains non-breaking space
144-
equal($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks');
148+
equal($('div.ui-datepicker-title').text(),
149+
$( "<span>November&#xa0;2009</span>" ).text(), 'After prev clicks');
145150
inp.datepicker('hide');
146151
});
147152

tests/unit/datepicker/datepicker_options.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ test('otherMonths', function() {
146146
var inp = TestHelpers.datepicker.init('#inp'),
147147
pop = $('#ui-datepicker-div');
148148
inp.val('06/01/2009').datepicker('show');
149-
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
149+
equal(pop.find('tbody').text(),
150+
// support: IE <9, jQuery <1.8
151+
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
152+
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
150153
'Other months - none');
151154
ok(pop.find('td:last *').length === 0, 'Other months - no content');
152155
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
@@ -158,7 +161,10 @@ test('otherMonths', function() {
158161
'Other months - select');
159162
ok(pop.find('td:last a').length === 1, 'Other months - link content');
160163
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
161-
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
164+
equal(pop.find('tbody').text(),
165+
// support: IE <9, jQuery <1.8
166+
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
167+
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
162168
'Other months - none');
163169
ok(pop.find('td:last *').length === 0, 'Other months - no content');
164170
});

0 commit comments

Comments
 (0)