Skip to content
This repository has been archived by the owner on Nov 17, 2019. It is now read-only.

Commit

Permalink
Upgrade d3-bundler.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 4, 2015
1 parent 4d1511f commit d77b39a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-selection-multi",
"version": "0.2.5",
"version": "0.2.6",
"description": "Multi-value map syntax for D3 selections.",
"keywords": [
"d3",
Expand All @@ -13,22 +13,24 @@
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"main": "build/d3",
"main": "build/selection-multi.cjs",
"jsnext:main": "index",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-selection-multi.git"
},
"scripts": {
"pretest": "mkdir -p build && d3-bundler --polyfill-map --format=umd --name=d3 -- d3.js > build/d3.js",
"pretest": "mkdir -p build && d3-bundler -x -f cjs -o build/selection-multi.cjs.js",
"test": "faucet `find test -name '*-test.js'`",
"prepublish": "npm run test && uglifyjs build/d3.js -c -m -o build/d3.min.js && rm -f build/d3.zip && zip -j build/d3.zip -- LICENSE README.md build/d3.js build/d3.min.js"
"prepublish": "npm run test && d3-bundler -n selectionMulti -o build/selection-multi.js && uglifyjs build/selection-multi.js -c -m -o build/selection-multi.min.js && rm -f build/selection-multi.zip && zip -j build/selection-multi.zip -- LICENSE README.md build/selection-multi.js build/selection-multi.min.js"
},
"dependencies": {
"d3-selection": "~0.4.10"
},
"devDependencies": {
"d3-bundler": "~0.2.5",
"d3-selection": "~0.4.5",
"d3-bundler": "~0.4.0",
"faucet": "0.0",
"jsdom": "3",
"jsdom": "7",
"tape": "4",
"uglify-js": "2"
}
Expand Down
12 changes: 7 additions & 5 deletions test/selection-attrs-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../");
selection = require("d3-selection");

require("../");

tape("selection.attrs sets attributes on selected elements", function(test) {
var document = jsdom.jsdom();
d3.select(document.body).attrs({foo: 42, bar: "BAR"});
selection.select(document.body).attrs({foo: 42, bar: "BAR"});
test.equal(document.body.getAttribute("foo"), "42");
test.equal(document.body.getAttribute("bar"), "BAR");
d3.select(document.body).attrs({foo: null});
selection.select(document.body).attrs({foo: null});
test.equal(document.body.hasAttribute("foo"), false);
test.end();
});
Expand All @@ -16,7 +18,7 @@ tape("selection.attrs can take a function that returns an object", function(test
var document = jsdom.jsdom("<h1>hello</h1><h2>world</h2>"),
h1 = document.querySelector("h1"),
h2 = document.querySelector("h2");
d3.selectAll([h1, h2]).attrs(function(d, i) { return !i ? {foo: 42} : {bar: "BAR"}; });
selection.selectAll([h1, h2]).attrs(function(d, i) { return !i ? {foo: 42} : {bar: "BAR"}; });
test.equal(h1.getAttribute("foo"), "42");
test.equal(h1.hasAttribute("bar"), false);
test.equal(h2.hasAttribute("foo"), false);
Expand All @@ -28,7 +30,7 @@ tape("selection.attrs can take an object with function values", function(test) {
var document = jsdom.jsdom("<h1>hello</h1><h2>world</h2>"),
h1 = document.querySelector("h1"),
h2 = document.querySelector("h2");
d3.selectAll([h1, h2]).attrs({
selection.selectAll([h1, h2]).attrs({
foo: function(d, i) { return !i ? 42 : null; },
bar: function(d, i) { return !i ? null : "BAR"; },
});
Expand Down

0 comments on commit d77b39a

Please # to comment.