title.subtextStyle.js 10 KB

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