Permalink
Browse files

Add more tests for chart options

  • Loading branch information...
buren committed Sep 30, 2018
1 parent b6424da commit 0427e0247611b266d8ecfc04f0237c98d38938cc
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/chartkick_test.exs
@@ -136,6 +136,24 @@ defmodule ChartkickTest do
assert String.contains?(script, expected)
end
test "chartkick_chart with chart messages option" do
script = Chartkick.chartkick_chart("", "{}", messages: %{:empty => "My message.."})
expected = "{\"messages\":{\"empty\":\"My message..\"}}"
assert String.contains?(script, expected)
end
test "chartkick_chart with chart label option as string" do
script = Chartkick.chartkick_chart("", "{}", legend: "bottom")
expected = "{\"legend\":\"bottom\"}"
assert String.contains?(script, expected)
end
test "chartkick_chart with chart label option as boolean" do
script = Chartkick.chartkick_chart("", "{}", legend: false)
expected = "{\"legend\":false}"
assert String.contains?(script, expected)
end
test "chartkick_chart with chart options" do
script = Chartkick.chartkick_chart("", "{}", stacked: true, min: nil, legend: false)
expected = "{\"stacked\":true,\"min\":null,\"legend\":false}"
@@ -153,4 +171,10 @@ defmodule ChartkickTest do
expected = "{\"library\":{\"backgroundColor\":\"#eee\"}}"
assert String.contains?(script, expected)
end
test "chartkick_chart with chart dataset option" do
script = Chartkick.chartkick_chart("", "{}", dataset: %{ borderWidth: 10 })
expected = "{\"dataset\":{\"borderWidth\":10}}"
assert String.contains?(script, expected)
end
end

0 comments on commit 0427e02

Please sign in to comment.