|
@@ -1,28 +1,26 @@
|
|
|
import { selectTimeGrid } from '../lib/time-grid'
|
|
import { selectTimeGrid } from '../lib/time-grid'
|
|
|
|
|
|
|
|
describe('selectAllow', function() {
|
|
describe('selectAllow', function() {
|
|
|
- var options
|
|
|
|
|
-
|
|
|
|
|
- beforeEach(function() {
|
|
|
|
|
- options = {
|
|
|
|
|
- now: '2016-09-04',
|
|
|
|
|
- defaultView: 'agendaWeek',
|
|
|
|
|
- scrollTime: '00:00',
|
|
|
|
|
- selectable: true
|
|
|
|
|
- }
|
|
|
|
|
- affix('#cal')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ pushOptions({
|
|
|
|
|
+ now: '2016-09-04',
|
|
|
|
|
+ defaultView: 'agendaWeek',
|
|
|
|
|
+ scrollTime: '00:00',
|
|
|
|
|
+ selectable: true
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('disallows selecting when returning false', function(done) { // and given correct params
|
|
it('disallows selecting when returning false', function(done) { // and given correct params
|
|
|
- options.selectAllow = function(selectInfo) {
|
|
|
|
|
- expect(typeof selectInfo).toBe('object')
|
|
|
|
|
- expect(moment.isMoment(selectInfo.start)).toBe(true)
|
|
|
|
|
- expect(moment.isMoment(selectInfo.end)).toBe(true)
|
|
|
|
|
- return false
|
|
|
|
|
|
|
+ var options = {
|
|
|
|
|
+ selectAllow: function(selectInfo) {
|
|
|
|
|
+ expect(typeof selectInfo).toBe('object')
|
|
|
|
|
+ expect(moment.isMoment(selectInfo.start)).toBe(true)
|
|
|
|
|
+ expect(moment.isMoment(selectInfo.end)).toBe(true)
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
spyOn(options, 'selectAllow').and.callThrough()
|
|
spyOn(options, 'selectAllow').and.callThrough()
|
|
|
|
|
|
|
|
- $('#cal').fullCalendar(options)
|
|
|
|
|
|
|
+ initCalendar(options)
|
|
|
|
|
|
|
|
selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
|
|
selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
|
|
|
.then(function(selectInfo) {
|
|
.then(function(selectInfo) {
|
|
@@ -33,12 +31,14 @@ describe('selectAllow', function() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('allows selecting when returning true', function(done) {
|
|
it('allows selecting when returning true', function(done) {
|
|
|
- options.selectAllow = function(selectInfo) {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ var options = {
|
|
|
|
|
+ selectAllow: function(selectInfo) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
spyOn(options, 'selectAllow').and.callThrough()
|
|
spyOn(options, 'selectAllow').and.callThrough()
|
|
|
|
|
|
|
|
- $('#cal').fullCalendar(options)
|
|
|
|
|
|
|
+ initCalendar(options)
|
|
|
|
|
|
|
|
selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
|
|
selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
|
|
|
.then(function(selectInfo) {
|
|
.then(function(selectInfo) {
|