fixedWeekCount.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. describe('fixedWeekCount', function() {
  2. var options;
  3. beforeEach(function() {
  4. affix('#cal');
  5. options = {
  6. defaultView: 'month',
  7. defaultDate: '2014-07-01' // has 5 weeks
  8. };
  9. });
  10. describe('when true', function() {
  11. beforeEach(function() {
  12. options.fixedWeekCount = true;
  13. });
  14. it('renders a 5-week month with 6 rows', function() {
  15. $('#cal').fullCalendar(options);
  16. var weeks = $('.fc-week');
  17. expect(weeks.length).toBe(6);
  18. });
  19. });
  20. describe('when false', function() {
  21. beforeEach(function() {
  22. options.fixedWeekCount = false;
  23. });
  24. it('renders a 5-week month with 5 rows', function() {
  25. $('#cal').fullCalendar(options);
  26. var weeks = $('.fc-week');
  27. expect(weeks.length).toBe(5);
  28. });
  29. });
  30. [ true, false ].forEach(function(bool) {
  31. describe('regardless of value (' + bool + ')', function() {
  32. beforeEach(function() {
  33. options.fixedWeekCount = bool;
  34. options.defaultDate = '2014-08-01'; // has 6 weeks
  35. });
  36. it('should render a 6-week month consistently', function() {
  37. $('#cal').fullCalendar(options);
  38. var weeks = $('.fc-week');
  39. expect(weeks.length).toBe(6);
  40. });
  41. });
  42. });
  43. });