minor formatting fixes for #5093
This commit is contained in:
parent
dac0433e2f
commit
58d9836b7d
@ -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)
|
||||
|
2
src/js/select2/data/select.js
vendored
2
src/js/select2/data/select.js
vendored
@ -244,7 +244,7 @@ define([
|
||||
};
|
||||
|
||||
SelectAdapter.prototype._normalizeItem = function (item) {
|
||||
if(item !== Object(item)){
|
||||
if (item !== Object(item)) {
|
||||
item = {
|
||||
id: item,
|
||||
text: item
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user