added test for #3564 fix
This commit is contained in:
parent
f5593e12e4
commit
af212fa530
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user