Skip to content

Commit 1828d14

Browse files
authored
Merge pull request #9 from LancerComet/hotfix/umd
+ Fix UMD export.
2 parents 0109045 + 11ce5ee commit 1828d14

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode/
2+
src/
3+
test/
4+
.babelrc
5+
.editorconfig
6+
.travis.yml
7+
gulpfile.js

dist/vue-jsonp.umd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
} else if (typeof exports === 'object') {
55
module.exports = factory();
66
} else {
7-
root.Index = factory();
7+
root.vueJsonp = factory();
88
}
99
}(this, function() {
1010
/**

gulpfile.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ gulp.task('js:build', () => {
4343
gulp.task('js:umd', (file) => {
4444
gulp.src(ENTRY)
4545
.pipe(umd({
46-
exports: function (file) { return 'vueJsonp' }
46+
exports (file) {
47+
return 'vueJsonp'
48+
},
49+
namespace (file) {
50+
return 'vueJsonp'
51+
}
4752
}))
4853
.pipe(rename('vue-jsonp.umd.js'))
4954
.pipe(gulp.dest(`${ROOTPATH}/dist`))
50-
})
55+
})

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
"JSONP"
99
],
1010
"scripts": {
11-
"build": "gulp",
11+
"predev": "gulp",
1212
"pretest": "gulp",
13+
"dev": "karma start ./test/karma.conf.js",
14+
"build": "gulp",
1315
"test": "karma start ./test/karma.conf.js --single-run"
1416
},
1517
"author": {

test/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// Polyfill fn.bind() for PhantomJS
21
/* eslint-disable no-extend-native */
32
Function.prototype.bind = require('function-bind')
43

5-
// require all test files (files that ends with .spec.js)
64
require('./specs/format-params.spec.js')
75
require('./specs/vue-jsonp.spec.js')

test/specs/format-params.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ describe('Param format testing.', function () {
3838

3939
expect(decodeURIComponent(result)).equal(expected)
4040
})
41+
42+
it('Should format params correctly - from issue.', function () {
43+
var self = {
44+
email: 'mail@hotmail.com',
45+
first_name: 'FirstName',
46+
last_name: 'LastName'
47+
}
48+
49+
var result = createQueryStr({
50+
'EMAIL': self.email,
51+
'FNAME': self.first_name,
52+
'LNAME': self.last_name
53+
})
54+
55+
var expected = 'EMAIL=' + self.email + '&FNAME=' + self.first_name + '&LNAME=' + self.last_name
56+
expect(decodeURIComponent(result)).equal(expected)
57+
})
4158
})
4259

4360
function createQueryStr (param) {

0 commit comments

Comments
 (0)