Gauge.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. topSuite("Ext.chart.series.Gauge", ['Ext.chart.*', 'Ext.data.ArrayStore'], function() {
  2. beforeEach(function() {
  3. // Silence warnings regarding Sencha download server
  4. spyOn(Ext.log, 'warn');
  5. });
  6. describe('series renderer', function () {
  7. var chart;
  8. afterEach(function() {
  9. Ext.destroy(chart);
  10. });
  11. it('should be called with the right index', function () {
  12. var indexes = [],
  13. layoutDone;
  14. runs(function () {
  15. chart = Ext.create({
  16. xtype: 'polar',
  17. renderTo: Ext.getBody(),
  18. width: 400,
  19. height: 400,
  20. series: {
  21. type: 'gauge',
  22. donut: 30,
  23. value: 60,
  24. minimum: 100,
  25. maximum: 800,
  26. needle: true,
  27. needleLength: 95,
  28. needleWidth: 8,
  29. totalAngle: Math.PI,
  30. label: {
  31. fontSize: 12,
  32. fontWeight: 'bold'
  33. },
  34. colors: ['maroon', 'blue', 'lightgray', 'red'],
  35. sectors: [{
  36. end: 300,
  37. label: 'Cold',
  38. color: 'dodgerblue'
  39. }, {
  40. end: 600,
  41. label: 'Temp.',
  42. color: 'lightgray'
  43. }, {
  44. end: 800,
  45. label: 'Hot',
  46. color: 'tomato'
  47. }],
  48. renderer: function (sprite, config, rendererData, spriteIndex) {
  49. indexes.push(spriteIndex);
  50. }
  51. },
  52. listeners: {
  53. layout: function () {
  54. layoutDone = true;
  55. }
  56. }
  57. });
  58. });
  59. waitsFor(function () {
  60. return layoutDone;
  61. });
  62. runs(function () {
  63. expect(indexes[0]).toEqual(1);
  64. expect(indexes[1]).toEqual(2);
  65. expect(indexes[2]).toEqual(3);
  66. });
  67. });
  68. });
  69. });