describe "d3 - selection - data" do after(:each) do D3.select("#test-area").html("") end let(:root) { D3.select("#test-area") } let(:html) { root.html } describe "list" do let(:data) {[ {name: "A", value: 10}, {name: "B", value: 20}, {name: "C", value: 30}, ]} it "enter" do root .append("ul") .select_all("li") .data(data) .enter .append("li") .html{|d| "#{d[:name]}"} .style("font-size"){|d| "#{d[:value]}px"} expect(html).to eq([ %Q[
11975 | 5871 | 8916 | 2868 |
1951 | 10048 | 2060 | 6171 |
8010 | 16145 | 8090 | 8045 |
1013 | 990 | 940 | 6907 |