Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petethepig committed Dec 21, 2015
1 parent 0137db5 commit 9e2d158
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tasks/website.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ gulp.task('serve', ['html', 'styles', 'scripts'], () => {

gulp.watch([
'{src,website}/scripts/**/*.coffee',
'test/**/*.coffee',
'src/templates/**/*.html',
'website/**/*.html',
'**/*.md'
]).on('change', reload);

gulp.watch('{src,website}/styles/**/*.scss', ['styles']);
gulp.watch('test/**/*.coffee', ['scripts']);
gulp.watch('{src,website}/scripts/**/*.coffee', ['scripts']);
gulp.watch('src/templates/**/*.html', ['scripts']);
gulp.watch('website/**/*.html', ['html']);
Expand Down
9 changes: 9 additions & 0 deletions test/array-utils.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe 'ArrayUtils', ->
ArrayUtils = $.fn.daterangepicker.ArrayUtils
describe '##rotateArray()', ->
it 'should work', () ->
assert.sameMembers(ArrayUtils.rotateArray([1, 2, 3, 4], 2), [3, 4, 1, 2])

describe '##uniqArray()', ->
it 'should work', () ->
assert.sameMembers(ArrayUtils.uniqArray([1, 2, 3, 1, 2, 4]), [1, 2, 3, 4])
23 changes: 23 additions & 0 deletions test/moment-iterator.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe 'MomentIterator', ->
MomentIterator = $.fn.daterangepicker.MomentIterator
fmt = 'YYYY-MM-DD'
describe '#next()', ->
it 'should work', () ->
iter = new MomentIterator(moment.utc([2015, 1, 1]), 'month')
assert.equal(iter.next().format(fmt), '2015-02-01')
assert.equal(iter.next().format(fmt), '2015-03-01')

describe '##array()', ->
it 'should work', () ->
arr = MomentIterator.array(moment.utc([2015, 1, 1]), 6, 'month')

expectations = [
'2015-02-01',
'2015-03-01',
'2015-04-01',
'2015-05-01',
'2015-06-01',
'2015-07-01'
]

assert.sameMembers(arr.map((x) -> x.format(fmt)), expectations)
6 changes: 6 additions & 0 deletions test/period.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe 'Period', ->
Period = $.fn.daterangepicker.Period
describe '##extendObservable()', ->
it 'should work', () ->
observable = Period.extendObservable(ko.observable('quarter'))
assert.equal(observable.format(), Period.format('quarter'))

0 comments on commit 9e2d158

Please sign in to comment.