Skip to content

Commit

Permalink
Compatibility with iOS 4.
Browse files Browse the repository at this point in the history
- `throw` cannot be used in a dot-context.
- Date cannot parse ISO strings (in the test-methods).
  • Loading branch information
fizker committed Jun 28, 2012
1 parent fd1d8c9 commit 4d82616
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/unit/ctor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('unit/ctor.spec.js', function() {
, date
beforeEach(function() {
var opts =
{ date: date = new Date('2012-01-02T12:00:00')
{ date: date = new Date(2012, 0, 2)
, unknown: 'option'
};
dp = ctor(opts);
Expand Down
8 changes: 4 additions & 4 deletions test/unit/event-emitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('unit/event-emitter.spec.js', function() {
it('should not throw', function() {
expect(function() {
dp.emit('event');
}).not.to.throw();
}).not.to['throw']();
});
});
describe('with listener', function() {
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('unit/event-emitter.spec.js', function() {
it('should not throw', function() {
expect(function() {
dp.on('event', spy);
}).not.to.throw();
}).not.to['throw']();
});
it('should return the date-picker for chaining', function() {
expect(dp.on('event', spy))
Expand All @@ -61,7 +61,7 @@ describe('unit/event-emitter.spec.js', function() {
it('should throw if not passed a callback', function() {
expect(function() {
dp.on('event');
}).to.throw();
}).to['throw']();
});
});

Expand All @@ -73,7 +73,7 @@ describe('unit/event-emitter.spec.js', function() {
it('should not throw', function() {
expect(function() {
dp.off('event', spy);
}).not.to.throw();
}).not.to['throw']();
});
it('should remove an added listener', function() {
dp
Expand Down
2 changes: 1 addition & 1 deletion test/unit/render.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('unit/render.spec.js', function() {
* This date is within february.
* It should build and append the entire month
*/
dp = ctor({ date: new Date('2012-02-12T12:00:00Z') });
dp = ctor({ date: new Date(2012, 1, 12) });
dp.render();
});
afterEach(function() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/show.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ describe('unit/show.spec.js', function() {
it('should attempt to look it up', function() {
expect(function() {
dp.show('invalid');
}).to.throw();
}).to['throw']();

expect(document.querySelector).to.have.been.calledWith('invalid');
});
it('should throw an exception', function() {
expect(function() {
dp.show('invalid');
}).to.throw('"invalid" does not resolve to an element!');
}).to['throw']('"invalid" does not resolve to an element!');
});
});
});
Expand Down
18 changes: 9 additions & 9 deletions test/unit/statics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('unit/statics.spec.js', function() {
describe('When calling formatDate(date, format)', function() {
var date
beforeEach(function() {
date = new Date('2012-04-05T12:00:00Z');
date = new Date(2012, 3, 5);
});
it('should return a string', function() {
var result = ctor.formatDate(date, 'y/m/d')
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('unit/statics.spec.js', function() {
var result
, opts
beforeEach(function() {
var date = new Date('2012-01-11T12:00:00Z')
var date = new Date(2012, 0, 11)
result = ctor.getCurrentMonth(date, opts);
});
it('should return all days in the month', function() {
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('unit/statics.spec.js', function() {
});
describe('and the last day is a thursday', function() {
beforeEach(function() {
var now = new Date('2012-05-01T12:00:00Z')
var now = new Date(2012, 4, 1)
result = ctor.getOverflowNext(now, opts)
});
it('should return three days', function() {
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('unit/statics.spec.js', function() {
});
describe('and the last day is a saturday', function() {
beforeEach(function() {
var now = new Date('2012-03-01T12:00:00Z')
var now = new Date(2012, 2, 1)
result = ctor.getOverflowNext(now, opts)
});
it('should return three days', function() {
Expand All @@ -138,7 +138,7 @@ describe('unit/statics.spec.js', function() {
});
describe('and the last day is a wednesday', function() {
beforeEach(function() {
var now = new Date('2012-02-01T12:00:00Z')
var now = new Date(2012, 1, 1)
result = ctor.getOverflowNext(now, opts)
});
it('should return six days', function() {
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('unit/statics.spec.js', function() {
});
describe('and the last day is a tuesday', function() {
beforeEach(function() {
var now = new Date('2012-01-01T12:00:00Z')
var now = new Date(2012, 0, 1)
result = ctor.getOverflowNext(now, opts)
});
it('should return an empty array', function() {
Expand All @@ -190,7 +190,7 @@ describe('unit/statics.spec.js', function() {

describe('and the first is a sunday', function() {
beforeEach(function() {
var now = new Date('2012-01-01T12:00:00Z')
var now = new Date(2012, 0, 1)
result = ctor.getOverflowPrev(now, opts)
});
it('should return six days', function() {
Expand Down Expand Up @@ -223,7 +223,7 @@ describe('unit/statics.spec.js', function() {

describe('and the first is a wednesday', function() {
beforeEach(function() {
var now = new Date('2012-02-01T12:00:00Z')
var now = new Date(2012, 1, 1)
result = ctor.getOverflowPrev(now, opts)
});
it('should return two days', function() {
Expand All @@ -244,7 +244,7 @@ describe('unit/statics.spec.js', function() {

describe('and the first is the first of the week', function() {
beforeEach(function() {
var now = new Date('2012-10-01T12:00:00Z')
var now = new Date(2012, 9, 1)
result = ctor.getOverflowPrev(now, opts)
});
it('should return an empty array', function() {
Expand Down

0 comments on commit 4d82616

Please sign in to comment.