api.donut-spec.ts 759 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { initChart } from './c3-helper'
  2. describe('c3 api donut', function() {
  3. 'use strict'
  4. var chart, args
  5. args = {
  6. data: {
  7. columns: [
  8. ['data1', 60],
  9. ['data2', 40]
  10. ],
  11. type: 'donut'
  12. },
  13. donut: {
  14. padAngle: 0.5
  15. }
  16. }
  17. beforeAll(function(done) {
  18. chart = initChart(chart, args, done)
  19. })
  20. it('can configure padAngle', function(done) {
  21. expect(chart.donut.padAngle()).toBe(0.5)
  22. const path = chart.internal.main.select('.c3-arc-data1').attr('d')
  23. chart.donut.padAngle(0.2)
  24. setTimeout(function() {
  25. expect(chart.donut.padAngle()).toBe(0.2)
  26. expect(chart.internal.main.select('.c3-arc-data1').attr('d')).not.toBe(
  27. path
  28. )
  29. done()
  30. }, 500)
  31. })
  32. })