diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..58c5dbe --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +.vscode/ +src/ +test/ +.babelrc +.editorconfig +.travis.yml +gulpfile.js diff --git a/dist/vue-jsonp.umd.js b/dist/vue-jsonp.umd.js index 860f3db..8bec04d 100644 --- a/dist/vue-jsonp.umd.js +++ b/dist/vue-jsonp.umd.js @@ -4,7 +4,7 @@ } else if (typeof exports === 'object') { module.exports = factory(); } else { - root.Index = factory(); + root.vueJsonp = factory(); } }(this, function() { /** diff --git a/gulpfile.js b/gulpfile.js index 608ddec..5ff3633 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -43,8 +43,13 @@ gulp.task('js:build', () => { gulp.task('js:umd', (file) => { gulp.src(ENTRY) .pipe(umd({ - exports: function (file) { return 'vueJsonp' } + exports (file) { + return 'vueJsonp' + }, + namespace (file) { + return 'vueJsonp' + } })) .pipe(rename('vue-jsonp.umd.js')) .pipe(gulp.dest(`${ROOTPATH}/dist`)) -}) \ No newline at end of file +}) diff --git a/package.json b/package.json index a1bfb69..c655281 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,10 @@ "JSONP" ], "scripts": { - "build": "gulp", + "predev": "gulp", "pretest": "gulp", + "dev": "karma start ./test/karma.conf.js", + "build": "gulp", "test": "karma start ./test/karma.conf.js --single-run" }, "author": { diff --git a/test/index.js b/test/index.js index 13c6704..b2a14a4 100644 --- a/test/index.js +++ b/test/index.js @@ -1,7 +1,5 @@ -// Polyfill fn.bind() for PhantomJS /* eslint-disable no-extend-native */ Function.prototype.bind = require('function-bind') -// require all test files (files that ends with .spec.js) require('./specs/format-params.spec.js') require('./specs/vue-jsonp.spec.js') diff --git a/test/specs/format-params.spec.js b/test/specs/format-params.spec.js index cee2b70..74fe9a0 100644 --- a/test/specs/format-params.spec.js +++ b/test/specs/format-params.spec.js @@ -38,6 +38,23 @@ describe('Param format testing.', function () { expect(decodeURIComponent(result)).equal(expected) }) + + it('Should format params correctly - from issue.', function () { + var self = { + email: 'mail@hotmail.com', + first_name: 'FirstName', + last_name: 'LastName' + } + + var result = createQueryStr({ + 'EMAIL': self.email, + 'FNAME': self.first_name, + 'LNAME': self.last_name + }) + + var expected = 'EMAIL=' + self.email + '&FNAME=' + self.first_name + '&LNAME=' + self.last_name + expect(decodeURIComponent(result)).equal(expected) + }) }) function createQueryStr (param) {