Skip to content

Commit

Permalink
minor formatting fixes for #5093
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweissman committed Oct 25, 2017
1 parent dac0433 commit 58d9836
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,9 @@

## 4.0.5

### Bug fixes
- User-defined types not normalized properly when passed in as data (#4632)

### Translations
- Czech: Add missing commas and periods (#5052)
- Spanish: Update the 'errorLoading' message (#5032)
Expand Down
2 changes: 1 addition & 1 deletion src/js/select2/data/select.js
Expand Up @@ -244,7 +244,7 @@ define([
};

SelectAdapter.prototype._normalizeItem = function (item) {
if(item !== Object(item)){
if (item !== Object(item)) {
item = {
id: item,
text: item
Expand Down
10 changes: 5 additions & 5 deletions tests/data/array-tests.js
Expand Up @@ -4,12 +4,12 @@ var ArrayData = require('select2/data/array');
var $ = require('jquery');
var Options = require('select2/options');

var UserDefinedType = function( id, text ){
var self=this;
var UserDefinedType = function (id, text) {
var self = this;

self.id = id;
self.text = text;

self.id=id;
self.text=text;

return self;
};

Expand Down
14 changes: 7 additions & 7 deletions tests/data/select-tests.js
Expand Up @@ -491,12 +491,12 @@ test('select option construction accepts id="" (empty string) value',
test('user-defined types are normalized properly', function (assert) {
var $select = $('#qunit-fixture .user-defined'),

UserDefinedType = function( id, text ){
var self=this;
UserDefinedType = function (id, text) {
var self = this;

self.id = id;
self.text = text;

self.id=id;
self.text=text;

return self;
};

Expand All @@ -507,14 +507,14 @@ test('user-defined types are normalized properly', function (assert) {
text: 'item'
},
new UserDefinedType(1, 'aaaaaa')
];
];

var data = new SelectData($select, selectOptions);

var normalizedItem = data._normalizeItem(testData[0]);
var normalizedItem2 = data._normalizeItem(testData[1]);
var normalizedItem3 = data._normalizeItem(testData[2]);

assert.equal(
testData[0],
normalizedItem.id,
Expand Down

0 comments on commit 58d9836

Please sign in to comment.