theme.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. describe('theme', function() {
  2. it('can be changed dynamically', function() {
  3. affix('#cal')
  4. $('#cal').fullCalendar({
  5. defaultView: 'agendaWeek'
  6. })
  7. expect($('.fc')).toHaveClass('fc-unthemed')
  8. expect($('.fc')).not.toHaveClass('ui-widget')
  9. expect($('.fc-toolbar button .fc-icon').length).toBeGreaterThan(0)
  10. expect($('.fc-toolbar button .ui-icon').length).toBe(0)
  11. expect($('.ui-widget-header').length).toBe(0)
  12. $('.fc-scroller').scrollTop(99999) // scroll all the way down
  13. var scrollTop = $('.fc-scroller').scrollTop()
  14. // change option!
  15. $('#cal').fullCalendar('option', 'theme', true)
  16. expect($('.fc')).toHaveClass('ui-widget')
  17. expect($('.fc')).not.toHaveClass('fc-unthemed')
  18. expect($('.fc-toolbar button .fc-icon').length).toBe(0)
  19. expect($('.fc-toolbar button .ui-icon').length).toBeGreaterThan(0)
  20. expect($('.ui-widget-header').length).toBeGreaterThan(0)
  21. // similar scroll state after the change
  22. expect(Math.abs(scrollTop - $('.fc-scroller').scrollTop())).toBeLessThan(5)
  23. })
  24. // this tests the options setter with a single hash argument.
  25. // TODO: not best place for this.
  26. it('can be change with other options', function() {
  27. affix('#cal')
  28. $('#cal').fullCalendar({
  29. defaultView: 'agendaWeek'
  30. })
  31. expect($('.fc')).toHaveClass('fc-unthemed')
  32. expect($('.fc')).not.toHaveClass('ui-widget')
  33. expect($('.fc-nonbusiness').length).toBe(0)
  34. // change option!
  35. $('#cal').fullCalendar('option', {
  36. theme: true,
  37. businessHours: true
  38. })
  39. expect($('.fc')).toHaveClass('ui-widget')
  40. expect($('.fc')).not.toHaveClass('fc-unthemed')
  41. expect($('.fc-nonbusiness').length).toBeGreaterThan(0)
  42. })
  43. })