This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test for _dateObservable, fixed a bug
- Loading branch information
1 parent
9e2d158
commit 0f7170d
Showing
3 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
describe 'Config', -> | ||
Config = $.fn.daterangepicker.Config | ||
fmt = 'YYYY-MM-DD' | ||
describe 'dateObservable', -> | ||
describe '#fit()', -> | ||
describe 'minDate', -> | ||
describe 'inclusive mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2015-05-14'), 'inclusive'] | ||
maxDate: [moment.utc('2016-01-01'), 'inclusive'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-05-25') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-06-15') | ||
|
||
describe 'exclusive mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2015-05-14'), 'exclusive'] | ||
maxDate: [moment.utc('2016-01-01'), 'inclusive'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-06-01') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-06-01') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-06-01') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-06-01') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-06-15') | ||
|
||
describe 'extended mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2015-05-14'), 'extended'] | ||
maxDate: [moment.utc('2016-01-01'), 'inclusive'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-05-01') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-05-05') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-05-25') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-06-15') | ||
|
||
describe 'maxDate', -> | ||
describe 'inclusive mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2014-01-01'), 'inclusive'] | ||
maxDate: [moment.utc('2015-05-14'), 'inclusive'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-04-15') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-05-05') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-05-14') | ||
|
||
describe 'exclusive mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2014-01-01'), 'inclusive'] | ||
maxDate: [moment.utc('2015-05-14'), 'exclusive'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-04-15') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-04-30') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-04-30') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-04-30') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-04-30') | ||
|
||
describe 'extended mode', -> | ||
it 'should work', () -> | ||
c = new Config({ | ||
period: 'month' | ||
minDate: [moment.utc('2014-01-01'), 'inclusive'] | ||
maxDate: [moment.utc('2015-05-14'), 'extended'] | ||
}) | ||
assert.equal(c.startDate.fit('2015-04-15').format(fmt), '2015-04-15') | ||
assert.equal(c.startDate.fit('2015-05-05').format(fmt), '2015-05-05') | ||
assert.equal(c.startDate.fit('2015-05-14').format(fmt), '2015-05-14') | ||
assert.equal(c.startDate.fit('2015-05-25').format(fmt), '2015-05-25') | ||
assert.equal(c.startDate.fit('2015-06-15').format(fmt), '2015-05-31') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,6 @@ | |
margin: 0 -5px; | ||
} | ||
|
||
#mocha .suite { | ||
#mocha #mocha-report>.suite { | ||
margin-left: 0; | ||
} |