Skip to content

Commit

Permalink
Merge pull request #36 from kuzzleio/bugfix
Browse files Browse the repository at this point in the history
bugfix
  • Loading branch information
scottinet committed Dec 24, 2015
2 parents b222adc + f6fe863 commit 6c4fa5e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/kuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
data = {},
action = 'create';

if (typeof id !== 'string' && id !== null) {
if (id && typeof id !== 'string') {
cb = options;
options = document;
document = id;
Expand Down
2 changes: 1 addition & 1 deletion dist/kuzzle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/kuzzle.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/kuzzleDataCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
data = {},
action = 'create';

if (typeof id !== 'string' && id !== null) {
if (id && typeof id !== 'string') {
cb = options;
options = document;
document = id;
Expand Down
11 changes: 11 additions & 0 deletions test/kuzzleDataCollection/methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ describe('KuzzleDataCollection methods', function () {
collection.createDocument(null, {}, {}, function () {});
should(emitted).be.true();

collection.createDocument(undefined, {});
should(emitted).be.true();

emitted = false;
collection.createDocument(undefined, {}, function () {});
should(emitted).be.true();

emitted = false;
collection.createDocument(undefined, {}, {}, function () {});
should(emitted).be.true();

emitted = false;
collection.createDocument({}, function () {});
should(emitted).be.true();
Expand Down

0 comments on commit 6c4fa5e

Please sign in to comment.