1
0
mirror of synced 2024-11-21 20:46:07 +03:00

minor formatting fixes for #5093

This commit is contained in:
alexweissman 2017-10-25 16:55:40 -04:00
parent dac0433e2f
commit 58d9836b7d
4 changed files with 16 additions and 13 deletions

View File

@ -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)

View File

@ -244,7 +244,7 @@ define([
};
SelectAdapter.prototype._normalizeItem = function (item) {
if(item !== Object(item)){
if (item !== Object(item)) {
item = {
id: item,
text: item

View File

@ -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;
};

View File

@ -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,