|
83 | 83 | expect(js).to match(
|
84 | 84 | /data_table.addRow\(\[\{v: \"2013\"\}\]\);/i)
|
85 | 85 | end
|
| 86 | + it "generates valid js of the combined charts" do |
| 87 | + js = combined.chart.to_html |
| 88 | + expect(js).to match(/google.visualization.Table/) |
| 89 | + expect(js).to match(/google.visualization.AreaChart/) |
| 90 | + expect(js).to match(/google.visualization.ColumnChart/) |
| 91 | + end |
| 92 | + end |
| 93 | + |
| 94 | + describe "#extract_multiple_charts_id_script_path" do |
| 95 | + it "returns correct path of the multiple_charts_div" do |
| 96 | + id_script_path = combined.chart.extract_multiple_charts_id_script_path |
| 97 | + expect(id_script_path[2]).to match( |
| 98 | + /templates\/googlecharts\/multiple_charts_div.erb/ |
| 99 | + ) |
| 100 | + end |
| 101 | + it "returns correct scripts of the multiple charts" do |
| 102 | + id_script_path = combined.chart.extract_multiple_charts_id_script_path |
| 103 | + expect(id_script_path[1][0]).to match(/google.visualization.Table/) |
| 104 | + expect(id_script_path[1][1]).to match(/google.visualization.AreaChart/) |
| 105 | + expect(id_script_path[1][2]).to match(/google.visualization.ColumnChart/) |
| 106 | + end |
| 107 | + end |
| 108 | + |
| 109 | + describe "#extract_chart_id_script_path" do |
| 110 | + it "returns correct path of the chart_div" do |
| 111 | + id_script_path = area_chart_chart.chart.extract_chart_id_script_path |
| 112 | + expect(id_script_path[2]).to match( |
| 113 | + /templates\/googlecharts\/chart_div.erb/ |
| 114 | + ) |
| 115 | + end |
| 116 | + it "returns correct script of the chart" do |
| 117 | + id_script_path = area_chart_chart.chart.extract_chart_id_script_path |
| 118 | + expect(id_script_path[1]).to match( |
| 119 | + /google.visualization.AreaChart/ |
| 120 | + ) |
| 121 | + end |
| 122 | + it "returns correct id of the chart" do |
| 123 | + id_script_path = area_chart_chart.chart.extract_chart_id_script_path('id') |
| 124 | + expect(id_script_path[0]).to eq('id') |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + describe "#set_chart_script" do |
| 129 | + it "sets correct script of the data_table" do |
| 130 | + js = data_table.table.set_chart_script(data_table, 'id') |
| 131 | + expect(js).to match(/google.visualization.Table/) |
| 132 | + end |
| 133 | + it "sets correct script of the chart" do |
| 134 | + js = area_chart_chart.chart.set_chart_script(area_chart_chart, 'id') |
| 135 | + expect(js).to match(/google.visualization.AreaChart/) |
| 136 | + end |
86 | 137 | end
|
87 | 138 |
|
88 | 139 | describe "#show_script" do
|
|
0 commit comments