eventLimitText.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. describe('eventLimitText', function() {
  2. pushOptions({
  3. defaultDate: '2014-08-01', // important that it is the first week, so works w/ month + week views
  4. defaultView: 'month',
  5. eventLimit: 3,
  6. events: [
  7. { title: 'event1', start: '2014-07-29' },
  8. { title: 'event2', start: '2014-07-29' },
  9. { title: 'event2', start: '2014-07-29' },
  10. { title: 'event2', start: '2014-07-29' }
  11. ]
  12. })
  13. it('allows a string', function() {
  14. initCalendar({
  15. eventLimitText: 'extra'
  16. })
  17. expect($('.fc-more')).toHaveText('+2 extra')
  18. })
  19. it('allows a function', function() {
  20. initCalendar({
  21. eventLimitText: function(n) {
  22. expect(typeof n).toBe('number')
  23. return 'there are ' + n + ' more events!'
  24. }
  25. })
  26. expect($('.fc-more')).toHaveText('there are 2 more events!')
  27. })
  28. it('has a default value that is affected by the custom locale', function() {
  29. initCalendar({
  30. locale: 'fr'
  31. })
  32. expect($('.fc-more')).toHaveText('+2 en plus')
  33. })
  34. it('is not affected by a custom locale when the value is explicitly specified', function() {
  35. initCalendar({
  36. locale: 'fr',
  37. eventLimitText: 'extra'
  38. })
  39. expect($('.fc-more')).toHaveText('+2 extra')
  40. })
  41. })