Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Fixed coverals
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Sep 6, 2017
1 parent 5fc840b commit b281ade
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
8 changes: 3 additions & 5 deletions dist/jquery.jcreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@
},
remove: function(handleObj) {
for (var _createList_key in _createList) {
if (_createList.hasOwnProperty(_createList_key)) {
if ($(this).is(_createList[_createList_key].$delegateTarget) && _createList[_createList_key].handleObj.selector === handleObj.selector) {
delete _createList[_createList_key];
break;
}
if (_createList.hasOwnProperty(_createList_key) && $(this).is(_createList[_createList_key].$delegateTarget) && _createList[_createList_key].handleObj.selector === handleObj.selector) {
delete _createList[_createList_key];
break;
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.jcreate.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions dist/jquery.jcreate.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@
},
remove: function(handleObj) {
for (var _createList_key in _createList) {
if (_createList.hasOwnProperty(_createList_key)) {
if ($(this).is(_createList[_createList_key].$delegateTarget) && _createList[_createList_key].handleObj.selector === handleObj.selector) {
delete _createList[_createList_key];
break;
}
if (_createList.hasOwnProperty(_createList_key) && $(this).is(_createList[_createList_key].$delegateTarget) && _createList[_createList_key].handleObj.selector === handleObj.selector) {
delete _createList[_createList_key];
break;
}
}
},
Expand Down
13 changes: 13 additions & 0 deletions spec/utlity.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ describe('jQuery.event.special.create.utility', function()
expect( jQuery.event.special.create.utility.filterDataByKey({width: 10, productKey:1, productName:'Android'}, 'product') ).toEqual({key:1, name:'Android'});
expect( jQuery.event.special.create.utility.filterDataByKey('this is a string!', 'product') ).toEqual('this is a string!');
});

it('.filterDataByKey() shouldn\'t break if the array object has been extended.', function()
{
// given
Array.prototype.newCoolFunction = function() {};
Object.prototype.newCoolFunction = function() {};

// then
expect(function() {
expect( jQuery.event.special.create.utility.filterDataByKey({width: 10, productKey:1, productName:'Android'}, 'product') ).toEqual({key:1, name:'Android'});
expect( jQuery.event.special.create.utility.filterDataByKey('this is a string!', 'product') ).toEqual('this is a string!');
}).not.toThrow();
});
});
9 changes: 3 additions & 6 deletions src/jquery.jcreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,10 @@
{
for (var _createList_key in _createList)
{
if ( _createList.hasOwnProperty( _createList_key ) )
if( _createList.hasOwnProperty( _createList_key ) && $(this).is( _createList[_createList_key].$delegateTarget ) && _createList[_createList_key].handleObj.selector === handleObj.selector )
{
if( $(this).is( _createList[_createList_key].$delegateTarget ) && _createList[_createList_key].handleObj.selector === handleObj.selector )
{
delete _createList[_createList_key];
break;
}
delete _createList[_createList_key];
break;
}
}
},
Expand Down

0 comments on commit b281ade

Please sign in to comment.