1
0
mirror of synced 2025-02-03 21:59:24 +03:00

Added test to make sure the options are generated

This commit is contained in:
Kevin Brown 2014-11-06 12:12:43 -05:00
parent 8ea23610f1
commit 8158e151ff
8 changed files with 14 additions and 22 deletions

View File

@ -1189,12 +1189,8 @@ define('select2/data/array',[
var item = data[d];
item.id = item.id.toString();
console.log(existingIds, item.id, existingIds.indexOf(item.id));
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
console.log(item.id);
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);

View File

@ -1189,12 +1189,8 @@ define('select2/data/array',[
var item = data[d];
item.id = item.id.toString();
console.log(existingIds, item.id, existingIds.indexOf(item.id));
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
console.log(item.id);
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);

View File

@ -10724,12 +10724,8 @@ define('select2/data/array',[
var item = data[d];
item.id = item.id.toString();
console.log(existingIds, item.id, existingIds.indexOf(item.id));
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
console.log(item.id);
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);

File diff suppressed because one or more lines are too long

4
dist/js/select2.js vendored
View File

@ -1617,12 +1617,8 @@ define('select2/data/array',[
var item = data[d];
item.id = item.id.toString();
console.log(existingIds, item.id, existingIds.indexOf(item.id));
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
console.log(item.id);
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);

File diff suppressed because one or more lines are too long

View File

@ -32,12 +32,8 @@ define([
var item = data[d];
item.id = item.id.toString();
console.log(existingIds, item.id, existingIds.indexOf(item.id));
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
console.log(item.id);
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);

View File

@ -174,3 +174,15 @@ test('multiple adds to the old value', function (assert) {
assert.deepEqual($select.val(), ['3', 'default']);
});
test('option tags are automatically generated', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new ArrayData($select, options);
assert.equal(
$select.find('option').length,
3,
'An <option> element should be created for each object'
);
});