buttonText.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. describe('button text', function() {
  2. pushOptions({
  3. header: {
  4. left: 'prevYear,prev,today,next,nextYear',
  5. center: '',
  6. right: 'month,basicWeek,basicDay,agendaWeek,agendaDay'
  7. }
  8. })
  9. describe('with default locale', function() {
  10. describe('with default buttonIcons', function() {
  11. it('should contain default text values', function() {
  12. initCalendar()
  13. // will have button icons, to text will be empty
  14. expect($('.fc-next-button')).toHaveText('')
  15. expect($('.fc-nextYear-button')).toHaveText('')
  16. expect($('.fc-prev-button')).toHaveText('')
  17. expect($('.fc-prevYear-button')).toHaveText('')
  18. expect($('.fc-today-button')).toHaveText('today')
  19. expect($('.fc-month-button')).toHaveText('month')
  20. expect($('.fc-basicWeek-button')).toHaveText('week')
  21. expect($('.fc-agendaWeek-button')).toHaveText('week')
  22. expect($('.fc-basicDay-button')).toHaveText('day')
  23. expect($('.fc-agendaDay-button')).toHaveText('day')
  24. })
  25. it('should contain specified text values', function() {
  26. initCalendar({
  27. buttonText: {
  28. prev: '<-',
  29. next: '->',
  30. prevYear: '<--',
  31. nextYear: '-->',
  32. today: 'tidei',
  33. month: 'mun',
  34. week: 'wiki',
  35. day: 'dei'
  36. }
  37. })
  38. expect($('.fc-next-button')).toHaveText('->')
  39. expect($('.fc-nextYear-button')).toHaveText('-->')
  40. expect($('.fc-prev-button')).toHaveText('<-')
  41. expect($('.fc-prevYear-button')).toHaveText('<--')
  42. expect($('.fc-today-button')).toHaveText('tidei')
  43. expect($('.fc-month-button')).toHaveText('mun')
  44. expect($('.fc-agendaDay-button')).toHaveText('dei')
  45. expect($('.fc-agendaWeek-button')).toHaveText('wiki')
  46. expect($('.fc-basicDay-button')).toHaveText('dei')
  47. expect($('.fc-basicWeek-button')).toHaveText('wiki')
  48. })
  49. })
  50. describe('with buttonIcons turned off', function() {
  51. pushOptions({
  52. buttonIcons: false
  53. })
  54. it('should contain default text values', function() {
  55. initCalendar()
  56. // will have actual text now
  57. expect($('.fc-next-button')).toHaveText('next')
  58. expect($('.fc-nextYear-button')).toHaveText('next year')
  59. expect($('.fc-prev-button')).toHaveText('prev')
  60. expect($('.fc-prevYear-button')).toHaveText('prev year')
  61. expect($('.fc-today-button')).toHaveText('today')
  62. expect($('.fc-month-button')).toHaveText('month')
  63. expect($('.fc-basicWeek-button')).toHaveText('week')
  64. expect($('.fc-agendaWeek-button')).toHaveText('week')
  65. expect($('.fc-basicDay-button')).toHaveText('day')
  66. expect($('.fc-agendaDay-button')).toHaveText('day')
  67. })
  68. it('should contain specified text values', function() {
  69. initCalendar({
  70. buttonText: {
  71. prev: '<-',
  72. next: '->',
  73. prevYear: '<--',
  74. nextYear: '-->',
  75. today: 'tidei',
  76. month: 'mun',
  77. week: 'wiki',
  78. day: 'dei'
  79. }
  80. })
  81. expect($('.fc-next-button')).toHaveText('->')
  82. expect($('.fc-nextYear-button')).toHaveText('-->')
  83. expect($('.fc-prev-button')).toHaveText('<-')
  84. expect($('.fc-prevYear-button')).toHaveText('<--')
  85. expect($('.fc-today-button')).toHaveText('tidei')
  86. expect($('.fc-month-button')).toHaveText('mun')
  87. expect($('.fc-agendaDay-button')).toHaveText('dei')
  88. expect($('.fc-agendaWeek-button')).toHaveText('wiki')
  89. expect($('.fc-basicDay-button')).toHaveText('dei')
  90. expect($('.fc-basicWeek-button')).toHaveText('wiki')
  91. })
  92. })
  93. })
  94. describe('when locale is not default', function() {
  95. pushOptions({
  96. locale: 'fr'
  97. })
  98. describe('with default buttonIcons', function() {
  99. it('should contain default text values', function() {
  100. initCalendar()
  101. // will contain icons, so will contain no text
  102. expect($('.fc-next-button')).toHaveText('')
  103. expect($('.fc-nextYear-button')).toHaveText('')
  104. expect($('.fc-prev-button')).toHaveText('')
  105. expect($('.fc-prevYear-button')).toHaveText('')
  106. expect($('.fc-today-button')).toHaveText('Aujourd\'hui')
  107. expect($('.fc-month-button')).toHaveText('Mois')
  108. expect($('.fc-basicWeek-button')).toHaveText('Semaine')
  109. expect($('.fc-agendaWeek-button')).toHaveText('Semaine')
  110. expect($('.fc-basicDay-button')).toHaveText('Jour')
  111. expect($('.fc-agendaDay-button')).toHaveText('Jour')
  112. })
  113. it('should contain specified text values', function() {
  114. initCalendar({
  115. buttonText: {
  116. prev: '<-',
  117. next: '->',
  118. prevYear: '<--',
  119. nextYear: '-->',
  120. today: 'tidei',
  121. month: 'mun',
  122. week: 'wiki',
  123. day: 'dei'
  124. }
  125. })
  126. expect($('.fc-next-button')).toHaveText('->')
  127. expect($('.fc-nextYear-button')).toHaveText('-->')
  128. expect($('.fc-prev-button')).toHaveText('<-')
  129. expect($('.fc-prevYear-button')).toHaveText('<--')
  130. expect($('.fc-today-button')).toHaveText('tidei')
  131. expect($('.fc-month-button')).toHaveText('mun')
  132. expect($('.fc-agendaDay-button')).toHaveText('dei')
  133. expect($('.fc-agendaWeek-button')).toHaveText('wiki')
  134. expect($('.fc-basicDay-button')).toHaveText('dei')
  135. expect($('.fc-basicWeek-button')).toHaveText('wiki')
  136. })
  137. })
  138. describe('with buttonIcons turned off', function() {
  139. pushOptions({
  140. buttonIcons: false
  141. })
  142. it('should contain default text values', function() {
  143. initCalendar()
  144. // will have the locale's actual text now
  145. expect($('.fc-next-button')).toHaveText('Suivant')
  146. expect($('.fc-prev-button')).toHaveText('Précédent')
  147. /// / locales files don't have data for prev/next *year*
  148. // expect($('.fc-nextYear-button')).toHaveText('Suivant');
  149. // expect($('.fc-prevYear-button')).toHaveText('Précédent');
  150. expect($('.fc-today-button')).toHaveText('Aujourd\'hui')
  151. expect($('.fc-month-button')).toHaveText('Mois')
  152. expect($('.fc-basicWeek-button')).toHaveText('Semaine')
  153. expect($('.fc-agendaWeek-button')).toHaveText('Semaine')
  154. expect($('.fc-basicDay-button')).toHaveText('Jour')
  155. expect($('.fc-agendaDay-button')).toHaveText('Jour')
  156. })
  157. it('should contain specified text values', function() {
  158. initCalendar({
  159. buttonText: {
  160. prev: '<-',
  161. next: '->',
  162. prevYear: '<--',
  163. nextYear: '-->',
  164. today: 'tidei',
  165. month: 'mun',
  166. week: 'wiki',
  167. day: 'dei'
  168. }
  169. })
  170. expect($('.fc-next-button')).toHaveText('->')
  171. expect($('.fc-nextYear-button')).toHaveText('-->')
  172. expect($('.fc-prev-button')).toHaveText('<-')
  173. expect($('.fc-prevYear-button')).toHaveText('<--')
  174. expect($('.fc-today-button')).toHaveText('tidei')
  175. expect($('.fc-month-button')).toHaveText('mun')
  176. expect($('.fc-agendaDay-button')).toHaveText('dei')
  177. expect($('.fc-agendaWeek-button')).toHaveText('wiki')
  178. expect($('.fc-basicDay-button')).toHaveText('dei')
  179. expect($('.fc-basicWeek-button')).toHaveText('wiki')
  180. })
  181. })
  182. })
  183. })