Skip to content

Commit

Permalink
Add Meteor export file so that the nv object is available globally in…
Browse files Browse the repository at this point in the history
… Meteor apps.
  • Loading branch information
jdlubrano committed Sep 9, 2015
1 parent bd681f8 commit 2e18777
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ before_install:
- "npm install -g grunt-cli"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
# Meteor Tinytest support
- "curl https://install.meteor.com | /bin/sh"
- export PATH="$HOME/.meteor:$PATH"
- "npm install -g spacejam"
install:
- "npm install"
- "bower install"

script: "spacejam test-packages ./"

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ only include the source files you changed!
* Also visually inspect the HTML pages in the **examples/ and test/ folders**. Make sure there are no glaring errors.
* Novus now uses Travis CI for continuous integration. Visit [our travis build page](https://travis-ci.org/novus/nvd3/) to see the latest status.

#### Meteor Tinytests
* Any Meteor-specific features can be tested from the command line using `tinytest` and [Spacejam](https://www.npmjs.com/package/spacejam)
* `spacejam` can be installed by running `npm install -g spacejam`.
* Tinytests can then be executed by running `spacejam test-packages nvd3:nvd3`.

---

## Building latest
Expand Down
4 changes: 4 additions & 0 deletions meteor/export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*global nv:true*/ // Meteor creates a file-scope global for exporting. This comment prevents a potential JSHint warning.
nv = window.nv;
delete window.nv;

9 changes: 8 additions & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ Package.on_use(function (api) {
api.use('d3js:[email protected]', 'client');
api.add_files('build/nv.d3.js', 'client');
api.add_files('build/nv.d3.css', 'client');
api.add_files('meteor/export.js', 'client');
api.export("nv");
});
});
Package.onTest(function(api) {
api.use(['tinytest', 'test-helpers']);
api.use('d3js:d3', 'client');
api.addFiles(['build/nv.d3.js', 'meteor/export.js'], "client");
api.addFiles('test/tinytest/nv-is-defined-test.js', "client");
});
6 changes: 6 additions & 0 deletions test/tinytest/nv-is-defined-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// nv-is-defined-test.js

Tinytest.add('nv object is defined', function(test) {
test.isNotUndefined(nv, 'nv is undefined at global scope for Meteor');
});

0 comments on commit 2e18777

Please sign in to comment.