title.textStyle.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. name: 'should display oblique not as normal',
  119. test: 'notEqualOption',
  120. option1: {
  121. series: [],
  122. title: {
  123. text: 'oblique vs. normal',
  124. textStyle: {
  125. fontStyle: 'oblique'
  126. }
  127. }
  128. },
  129. option2: {
  130. series: [],
  131. title: {
  132. text: 'oblique vs. normal',
  133. textStyle: {
  134. fontStyle: 'normal'
  135. }
  136. }
  137. }
  138. }]
  139. }, {
  140. name: 'textStyle.fontWeight',
  141. cases: [{
  142. name: 'should display default normal font weight',
  143. test: 'equalOption',
  144. option1: {
  145. series: [],
  146. title: {
  147. text: 'normal font'
  148. }
  149. },
  150. option2: {
  151. series: [],
  152. title: {
  153. text: 'normal font',
  154. textStyle: {
  155. fontWeight: 'normal'
  156. }
  157. }
  158. }
  159. }, {
  160. name: 'should display bold font weight',
  161. test: 'notEqualOption',
  162. option1: {
  163. series: [],
  164. title: {
  165. text: 'bold font vs. normal font',
  166. textStyle: {
  167. fontStyle: 'bold'
  168. }
  169. }
  170. },
  171. option2: {
  172. series: [],
  173. title: {
  174. text: 'bold font vs. normal font',
  175. textStyle: {
  176. fontStyle: 'normal'
  177. }
  178. }
  179. }
  180. }, {
  181. name: 'should display bolder font weight',
  182. test: 'notEqualOption',
  183. option1: {
  184. series: [],
  185. title: {
  186. text: 'bolder font vs. normal font',
  187. textStyle: {
  188. fontStyle: 'bolder'
  189. }
  190. }
  191. },
  192. option2: {
  193. series: [],
  194. title: {
  195. text: 'bolder font vs. normal font',
  196. textStyle: {
  197. fontStyle: 'normal'
  198. }
  199. }
  200. }
  201. }, {
  202. name: 'should display light font weight',
  203. test: 'notEqualOption',
  204. option1: {
  205. series: [],
  206. title: {
  207. text: 'light font vs. normal font',
  208. textStyle: {
  209. fontStyle: 'light'
  210. }
  211. }
  212. },
  213. option2: {
  214. series: [],
  215. title: {
  216. text: 'light font vs. normal font',
  217. textStyle: {
  218. fontStyle: 'normal'
  219. }
  220. }
  221. }
  222. }, {
  223. name: 'should display numbering font weight',
  224. test: 'notEqualOption',
  225. option1: {
  226. series: [],
  227. title: {
  228. text: '100 font vs. normal font',
  229. textStyle: {
  230. fontStyle: '100'
  231. }
  232. }
  233. },
  234. option2: {
  235. series: [],
  236. title: {
  237. text: '100 font vs. normal font',
  238. textStyle: {
  239. fontStyle: 'normal'
  240. }
  241. }
  242. }
  243. }]
  244. }, {
  245. name: 'textStyle.fontFamily',
  246. cases: [{
  247. name: 'should display default fontFamily as sans-serif',
  248. test: 'equalOption',
  249. option1: {
  250. series: [],
  251. title: {
  252. text: 'sans-serif'
  253. }
  254. },
  255. option2: {
  256. series: [],
  257. title: {
  258. text: 'sans-serif',
  259. fontFamily: 'sans-serif'
  260. }
  261. }
  262. }, {
  263. name: 'should display default fontFamily as Arial',
  264. test: 'notEqualOption',
  265. option1: {
  266. series: [],
  267. title: {
  268. text: 'Arial vs. sans-serif',
  269. textStyle: {
  270. fontFamily: 'Arial'
  271. }
  272. }
  273. },
  274. option2: {
  275. series: [],
  276. title: {
  277. text: 'Arial vs. sans-serif',
  278. fontFamily: 'sans-serif'
  279. }
  280. }
  281. }]
  282. }, {
  283. name: 'textStyle.fontSize',
  284. cases: [{
  285. name: 'should display default fontSize at 18',
  286. test: 'equalOption',
  287. option1: {
  288. series: [],
  289. title: {
  290. text: 'default font size, should be 18'
  291. }
  292. },
  293. option2: {
  294. series: [],
  295. title: {
  296. text: 'default font size, should be 18',
  297. textStyle: {
  298. fontSize: 18
  299. }
  300. }
  301. }
  302. }, {
  303. name: 'should display larger fontSize',
  304. test: 'notEqualOption',
  305. option1: {
  306. series: [],
  307. title: {
  308. text: 'larger font size, 30',
  309. textStyle: {
  310. fontSize: 30
  311. }
  312. }
  313. },
  314. option2: {
  315. series: [],
  316. title: {
  317. text: 'larger font size, 30',
  318. textStyle: {
  319. fontSize: 18
  320. }
  321. }
  322. }
  323. }, {
  324. name: 'should display smaller fontSize',
  325. test: 'notEqualOption',
  326. option1: {
  327. series: [],
  328. title: {
  329. text: 'smaller font size, 12',
  330. textStyle: {
  331. fontSize: 12
  332. }
  333. }
  334. },
  335. option2: {
  336. series: [],
  337. title: {
  338. text: 'smaller font size, 12',
  339. textStyle: {
  340. fontSize: 18
  341. }
  342. }
  343. }
  344. }]
  345. }];
  346. uiHelper.testOptionSpec('title.textStyle', suites);
  347. });