Sha256: 42acfdc90c38b9e303a66646d289c6806806446a1ef74291b4364de55a4a5588

Contents?: true

Size: 988 Bytes

Versions: 4

Compression:

Stored size: 988 Bytes

Contents

var vows = require("vows"),
    load = require("../load"),
    assert = require("../assert");

var suite = vows.describe("selection.order");

suite.addBatch({
  "selectAll(div)": {
    topic: load("selection/call").document(),
    "on a simple page": {
      topic: function(d3) {
        return d3.select("body").selectAll("div")
            .data([1, 2, 10, 20])
          .enter().append("div")
            .attr("id", String);
      },
      "orders elements by data": function(div) {
        div = div.data([1, 10, 20, 2], String).order();
        assert.domNull(div[0][0].previousSibling);
        assert.domEqual(div[0][1].previousSibling, div[0][0]);
        assert.domEqual(div[0][2].previousSibling, div[0][1]);
        assert.domEqual(div[0][3].previousSibling, div[0][2]);
        assert.domNull(div[0][3].nextSibling);
      },
      "returns the current selection": function(span) {
        assert.isTrue(span.order() === span);
      }
    }
  }
});

suite.export(module);

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
stripchart-0.0.3 lib/stripchart/public/components/d3/test/selection/order-test.js
stripmem-0.0.3 lib/stripmem/public/components/d3/test/selection/order-test.js
stripmem-0.0.2 lib/stripmem/public/components/d3/test/selection/order-test.js
stripmem-0.0.1 lib/stripmem/public/components/d3/test/selection/order-test.js