Permalink
Browse files

Add Meteor export file so that the nv object is available globally in…

… Meteor apps.
  • Loading branch information...
1 parent bd681f8 commit 2e18777e571497dd5d4cc108d7d9215b3fa5458c @jdlubrano jdlubrano committed Sep 9, 2015
Showing with 30 additions and 1 deletion.
  1. +7 −0 .travis.yml
  2. +5 −0 README.md
  3. +4 −0 meteor/export.js
  4. +8 −1 package.js
  5. +6 −0 test/tinytest/nv-is-defined-test.js
View
@@ -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 ./"
+
View
@@ -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
View
@@ -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;
+
View
@@ -13,5 +13,12 @@ Package.on_use(function (api) {
api.use('d3js:d3@3.5.5', '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");
+});
@@ -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.