Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
describe 'Morris.Area', ->
2
 
3
  describe 'svg structure', ->
4
    defaults =
5
      element: 'graph'
6
      data: [{x: '2012 Q1', y: 1}, {x: '2012 Q2', y: 1}]
7
      lineColors: [ '#0b62a4', '#7a92a3']
8
      gridLineColor: '#aaa'
9
      xkey: 'x'
10
      ykeys: ['y']
11
      labels: ['Y']
12
 
13
    it 'should contain a line path for each line', ->
14
      chart = Morris.Area $.extend {}, defaults
15
      $('#graph').find("path[stroke='#0b62a4']").size().should.equal 1
16
 
17
    it 'should contain a path with stroke-width 0 for each line', ->
18
      chart = Morris.Area $.extend {}, defaults
19
      $('#graph').find("path[stroke='#0b62a4']").size().should.equal 1
20
 
21
    it 'should contain 5 grid lines', ->
22
      chart = Morris.Area $.extend {}, defaults
23
      $('#graph').find("path[stroke='#aaaaaa']").size().should.equal 5
24
 
25
    it 'should contain 9 text elements', ->
26
      chart = Morris.Area $.extend {}, defaults
27
      $('#graph').find("text").size().should.equal 9
28
 
29
  describe 'svg attributes', ->
30
    defaults =
31
      element: 'graph'
32
      data: [{x: '2012 Q1', y: 1}, {x: '2012 Q2', y: 1}]
33
      xkey: 'x'
34
      ykeys: ['y']
35
      labels: ['Y']
36
      lineColors: [ '#0b62a4', '#7a92a3']
37
      lineWidth: 3
38
      pointWidths: [5]
39
      pointStrokeColors: ['#ffffff']
40
      gridLineColor: '#aaa'
41
      gridStrokeWidth: 0.5
42
      gridTextColor: '#888'
43
      gridTextSize: 12
44
 
45
    it 'should not be cumulative if behaveLikeLine', ->
46
      chart = Morris.Area $.extend {}, defaults, behaveLikeLine: true
47
      chart.cumulative.should.equal false
48
 
49
    it 'should have a line with transparent fill if behaveLikeLine', ->
50
      chart = Morris.Area $.extend {}, defaults, behaveLikeLine: true
51
      $('#graph').find("path[fill-opacity='0.8']").size().should.equal 1
52
 
53
    it 'should not have a line with transparent fill', ->
54
      chart = Morris.Area $.extend {}, defaults
55
      $('#graph').find("path[fill-opacity='0.8']").size().should.equal 0
56
 
57
    it 'should have a line with the fill of a modified line color', ->
58
      chart = Morris.Area $.extend {}, defaults
59
      $('#graph').find("path[fill='#0b62a4']").size().should.equal 0
60
      $('#graph').find("path[fill='#7a92a3']").size().should.equal 0