Datepicker tests: Work around encoding issues in oldIE.

This commit is contained in:
Scott González 2012-11-15 18:57:44 -05:00
parent 8c36603305
commit ccdceddd80
2 changed files with 16 additions and 5 deletions

View File

@ -132,16 +132,21 @@ test('beforeShowDay-getDate', function() {
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
// contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
equal($('div.ui-datepicker-title').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>January&#xa0;2010</span>" ).text(), 'Initial month');
$('a.ui-datepicker-next', dp).click();
$('a.ui-datepicker-next', dp).click();
// contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks');
equal($('div.ui-datepicker-title').text(),
$( "<span>March&#xa0;2010</span>" ).text(), 'After next clicks');
inp.datepicker('hide').datepicker('show');
$('a.ui-datepicker-prev', dp).click();
$('a.ui-datepicker-prev', dp).click();
// contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks');
equal($('div.ui-datepicker-title').text(),
$( "<span>November&#xa0;2009</span>" ).text(), 'After prev clicks');
inp.datepicker('hide');
});

View File

@ -146,7 +146,10 @@ test('otherMonths', function() {
var inp = TestHelpers.datepicker.init('#inp'),
pop = $('#ui-datepicker-div');
inp.val('06/01/2009').datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
equal(pop.find('tbody').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
'Other months - none');
ok(pop.find('td:last *').length === 0, 'Other months - no content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
@ -158,7 +161,10 @@ test('otherMonths', function() {
'Other months - select');
ok(pop.find('td:last a').length === 1, 'Other months - link content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
equal(pop.find('tbody').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
'Other months - none');
ok(pop.find('td:last *').length === 0, 'Other months - no content');
});