Skip to content

Commit

Permalink
Correct Line length
Browse files Browse the repository at this point in the history
  • Loading branch information
Prakriti-nith committed Jun 15, 2018
1 parent 2b15433 commit 6809d90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/daru/view/adapters/highcharts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def init(data=[], options={})
f.options = options.empty? ? LazyHighCharts::HighChart.new.defaults_options : options
# For multiple series when data is in a series format as in
# HighCharts official examples
# TODO: Add support for multiple series when data as Daru::DataFrame/Daru::Vector
# TODO: Add support for multiple series when data as
# Daru::DataFrame/Daru::Vector
if data.is_a?(Array) && data[0].is_a?(Hash)
f.series_data = data
else
Expand Down
3 changes: 2 additions & 1 deletion spec/adapters/highcharts/layout_helper_iruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
text: 'Nordic countries'
},
subtitle: {
text: 'Demo of drawing all areas in the map, only highlighting partial data'
text: 'Demo of drawing all areas in the map, only highlighting '\
'partial data'
},
legend: {
enabled: false
Expand Down
12 changes: 9 additions & 3 deletions spec/adapters/highcharts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,24 @@
end
context "when multiple series is used as data" do
it "should generate valid JS of the Chart" do
js = @chart_multiple_series.adapter.generate_body(@chart_multiple_series.chart)
js = @chart_multiple_series.adapter.generate_body(
@chart_multiple_series.chart
)
expect(js).to match(/script/)
expect(js).to match(/Highcharts.Chart\(options\)/)
expect(js).to match(/window.chart_/)
end
it "should set the correct options" do
js = @chart_multiple_series.adapter.generate_body(@chart_multiple_series.chart)
js = @chart_multiple_series.adapter.generate_body(
@chart_multiple_series.chart
)
expect(js).to match(/\"chart\": { \"type\": \"bar\"/)
expect(js).to match(/\"title\": { \"text\": \"Demo Bar Chart\" }/)
end
it "should set correct data" do
js = @chart_multiple_series.adapter.generate_body(@chart_multiple_series.chart)
js = @chart_multiple_series.adapter.generate_body(
@chart_multiple_series.chart
)
# indicates series contains array of hashes
expect(js).to match(/series": \[\{/)
end
Expand Down

0 comments on commit 6809d90

Please sign in to comment.