title.textStyle.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. describe('title.textStyle', function() {
  2. var uiHelper = window.uiHelper;
  3. var suites = [{
  4. name: 'textStyle.color',
  5. cases: [{
  6. name: 'should display expected color name',
  7. option: {
  8. series: [],
  9. title: {
  10. text: 'a red title',
  11. textStyle: {
  12. color: 'red'
  13. }
  14. }
  15. }
  16. }, {
  17. name: 'should display expected color 6-digit hex',
  18. option: {
  19. series: [],
  20. title: {
  21. text: 'an orange title',
  22. textStyle: {
  23. color: '#ff6600'
  24. }
  25. }
  26. }
  27. }, {
  28. name: 'should display expected color 3-digit hex',
  29. option: {
  30. series: [],
  31. title: {
  32. text: 'an orange title',
  33. textStyle: {
  34. color: '#f60'
  35. }
  36. }
  37. }
  38. }, {
  39. name: 'should display expected color rgb',
  40. option: {
  41. series: [],
  42. title: {
  43. text: 'an orange title',
  44. textStyle: {
  45. color: 'rgb(255, 127, 0)'
  46. }
  47. }
  48. }
  49. }, {
  50. name: 'should display expected color rgba',
  51. option: {
  52. series: [],
  53. title: {
  54. text: 'an orange title with alpha',
  55. textStyle: {
  56. color: 'rgba(255, 127, 0, 0.5)'
  57. }
  58. }
  59. }
  60. }]
  61. }, {
  62. name: 'textStyle.fontStyle',
  63. cases: [{
  64. name: 'should display normal font style',
  65. option: {
  66. series: [],
  67. title: {
  68. text: 'normal font',
  69. textStyle: {
  70. fontStyle: 'normal'
  71. }
  72. }
  73. }
  74. }, {
  75. name: 'should display italic font style',
  76. option: {
  77. series: [],
  78. title: {
  79. text: 'italic font',
  80. textStyle: {
  81. fontStyle: 'italic'
  82. }
  83. }
  84. }
  85. }, {
  86. name: 'should display oblique font style',
  87. option: {
  88. series: [],
  89. title: {
  90. text: 'oblique font',
  91. textStyle: {
  92. fontStyle: 'oblique'
  93. }
  94. }
  95. }
  96. }, {
  97. name: 'should display italic not as normal',
  98. test: 'notEqualOption',
  99. option1: {
  100. series: [],
  101. title: {
  102. text: 'italic vs. normal',
  103. textStyle: {
  104. fontStyle: 'italic'
  105. }
  106. }
  107. },
  108. option2: {
  109. series: [],
  110. title: {
  111. text: 'italic vs. normal',
  112. textStyle: {
  113. fontStyle: 'normal'
  114. }
  115. }
  116. }
  117. }]
  118. }, {
  119. name: 'textStyle.fontWeight',
  120. cases: [{
  121. name: 'should display default bolder font weight by default',
  122. test: 'equalOption',
  123. option1: {
  124. series: [],
  125. title: {
  126. text: 'bolder font'
  127. }
  128. },
  129. option2: {
  130. series: [],
  131. title: {
  132. text: 'bolder font',
  133. textStyle: {
  134. fontWeight: 'bolder'
  135. }
  136. }
  137. }
  138. }, {
  139. name: 'should display bold font weight',
  140. test: 'notEqualOption',
  141. option1: {
  142. series: [],
  143. title: {
  144. text: 'bold font vs. normal font',
  145. textStyle: {
  146. fontStyle: 'bold'
  147. }
  148. }
  149. },
  150. option2: {
  151. series: [],
  152. title: {
  153. text: 'bold font vs. normal font',
  154. textStyle: {
  155. fontStyle: 'normal'
  156. }
  157. }
  158. }
  159. }, {
  160. name: 'should display normal font weight',
  161. test: 'notEqualOption',
  162. option1: {
  163. series: [],
  164. title: {
  165. text: 'bolder font vs. normal font',
  166. textStyle: {
  167. fontStyle: 'normal'
  168. }
  169. }
  170. },
  171. option2: {
  172. series: [],
  173. title: {
  174. text: 'bolder font vs. normal font',
  175. textStyle: {
  176. fontStyle: 'bold'
  177. }
  178. }
  179. }
  180. }, {
  181. name: 'should display light font weight',
  182. test: 'notEqualOption',
  183. option1: {
  184. series: [],
  185. title: {
  186. text: 'light font vs. normal font',
  187. textStyle: {
  188. fontStyle: 'light'
  189. }
  190. }
  191. },
  192. option2: {
  193. series: [],
  194. title: {
  195. text: 'light font vs. normal font',
  196. textStyle: {
  197. fontStyle: 'normal'
  198. }
  199. }
  200. }
  201. }, {
  202. name: 'should display numbering font weight',
  203. test: 'notEqualOption',
  204. option1: {
  205. series: [],
  206. title: {
  207. text: '100 font vs. normal font',
  208. textStyle: {
  209. fontStyle: '100'
  210. }
  211. }
  212. },
  213. option2: {
  214. series: [],
  215. title: {
  216. text: '100 font vs. normal font',
  217. textStyle: {
  218. fontStyle: 'normal'
  219. }
  220. }
  221. }
  222. }]
  223. }, {
  224. name: 'textStyle.fontFamily',
  225. cases: [{
  226. name: 'should display default fontFamily as sans-serif',
  227. test: 'equalOption',
  228. option1: {
  229. series: [],
  230. title: {
  231. text: 'sans-serif'
  232. }
  233. },
  234. option2: {
  235. series: [],
  236. title: {
  237. text: 'sans-serif',
  238. fontFamily: 'sans-serif'
  239. }
  240. }
  241. }, {
  242. name: 'should display default fontFamily as Arial',
  243. test: 'notEqualOption',
  244. option1: {
  245. series: [],
  246. title: {
  247. text: 'Arial vs. sans-serif',
  248. textStyle: {
  249. fontFamily: 'Arial'
  250. }
  251. }
  252. },
  253. option2: {
  254. series: [],
  255. title: {
  256. text: 'Arial vs. sans-serif',
  257. fontFamily: 'sans-serif'
  258. }
  259. }
  260. }]
  261. }, {
  262. name: 'textStyle.fontSize',
  263. cases: [{
  264. name: 'should display default fontSize at 18',
  265. test: 'equalOption',
  266. option1: {
  267. series: [],
  268. title: {
  269. text: 'default font size, should be 18'
  270. }
  271. },
  272. option2: {
  273. series: [],
  274. title: {
  275. text: 'default font size, should be 18',
  276. textStyle: {
  277. fontSize: 18
  278. }
  279. }
  280. }
  281. }, {
  282. name: 'should display larger fontSize',
  283. test: 'notEqualOption',
  284. option1: {
  285. series: [],
  286. title: {
  287. text: 'larger font size, 30',
  288. textStyle: {
  289. fontSize: 30
  290. }
  291. }
  292. },
  293. option2: {
  294. series: [],
  295. title: {
  296. text: 'larger font size, 30',
  297. textStyle: {
  298. fontSize: 18
  299. }
  300. }
  301. }
  302. }, {
  303. name: 'should display smaller fontSize',
  304. test: 'notEqualOption',
  305. option1: {
  306. series: [],
  307. title: {
  308. text: 'smaller font size, 12',
  309. textStyle: {
  310. fontSize: 12
  311. }
  312. }
  313. },
  314. option2: {
  315. series: [],
  316. title: {
  317. text: 'smaller font size, 12',
  318. textStyle: {
  319. fontSize: 18
  320. }
  321. }
  322. }
  323. }]
  324. }];
  325. uiHelper.testOptionSpec('title.textStyle', suites);
  326. });