1
0
mirror of synced 2024-11-22 21:16:10 +03:00

added test for #3564 fix

This commit is contained in:
Phil Eberhardt 2015-07-11 22:11:55 -04:00
parent f5593e12e4
commit af212fa530

View File

@ -21,6 +21,21 @@ var arrayOptions = new Options({
]
});
var extraOptions = new Options ({
data: [
{
id: 'default',
text: 'Default',
extra: true
},
{
id: 'One',
text: 'One',
extra: true
}
]
});
var nestedOptions = new Options({
data: [
{
@ -206,6 +221,36 @@ test('option tags are automatically generated', function (assert) {
);
});
test('option tags can receive new data', function(assert) {
var $select = $('#qunit-fixture .single');
var data = new ArrayData($select, extraOptions);
assert.equal(
$select.find('option').length,
2,
'Only one more <option> element should be created'
);
data.select({
id: 'default'
});
assert.ok(
$select.find(':selected').data('data').extra,
'<option> default should have new data'
);
data.select({
id: 'One'
});
assert.ok(
$select.find(':selected').data('data').extra,
'<option> One should have new data'
);
});
test('optgroup tags can also be generated', function (assert) {
var $select = $('#qunit-fixture .single-empty');