Skip to content

Commit 75a7305

Browse files
committed
Test: update test wrong and add test for class/style attributes
1 parent 7721770 commit 75a7305

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

test/setup.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
optgroupValueField: 'val',
8888
optgroupField: 'grp',
8989
disabledField: 'dis'
90-
});
90+
});
9191
assert.deepEqual(test.selectize.options, {
92-
'a': {text: 'Item A', value: 'a', grp: ['Group 1', 'Group 2'], $order: 1, dis: false},
93-
'b': {text: 'Item B', value: 'b', grp: ['Group 1', 'Group 2'], $order: 2, dis: false}
92+
'a': {text: 'Item A', value: 'a', grp: ['Group 1', 'Group 2'], $order: 1, dis: false, styles: '', classes: ''},
93+
'b': {text: 'Item B', value: 'b', grp: ['Group 1', 'Group 2'], $order: 2, dis: false, styles: '', classes: ''}
9494
});
9595
assert.deepEqual(test.selectize.optgroups, {
9696
'Group 1': {label: 'Group 1', val: 'Group 1', $order: 3, dis: false},
@@ -111,10 +111,10 @@
111111
optgroupValueField: 'val',
112112
optgroupField: 'grp',
113113
disabledField: 'dis'
114-
});
114+
});
115115
assert.deepEqual(test.selectize.options, {
116-
'a': {text: 'Item A', value: 'a', grp: ['Group 1', 'Group 2'], $order: 1, dis: true},
117-
'b': {text: 'Item B', value: 'b', grp: ['Group 1', 'Group 2'], $order: 2, dis: false}
116+
'a': {text: 'Item A', value: 'a', grp: ['Group 1', 'Group 2'], $order: 1, dis: true, styles: '', classes: ''},
117+
'b': {text: 'Item B', value: 'b', grp: ['Group 1', 'Group 2'], $order: 2, dis: false, styles: '', classes: ''}
118118
});
119119
assert.deepEqual(test.selectize.optgroups, {
120120
'Group 1': {label: 'Group 1', val: 'Group 1', $order: 3, dis: false},
@@ -210,7 +210,27 @@
210210
expect(test.selectize.$dropdown.find('[data-selectable]')).to.has.length(1);
211211
done();
212212
}, 0);
213-
});
213+
});
214+
it('should respect option style / class', function () {
215+
var test;
216+
217+
beforeEach(function() {
218+
test = setup_test('<select>' +
219+
'<option value="a" style="color:red;" class="a">A</option>' +
220+
'</select>', {
221+
dropdownSize: { sizeType: 'fixedHeight', sizeValue: 100 }
222+
});
223+
});
224+
225+
it('should dropdown height to be equal 100', function(done) {
226+
test.selectize.focus();
227+
228+
window.setTimeout(function () {
229+
expect(test.selectize.$dropdown_content.find('.option').attr('style')).to.be.equal('color:red;');
230+
expect(test.selectize.$dropdown_content.find('.option').hasClass('a')).to.be.equal(true);
231+
}, 0);
232+
});
233+
});
214234
describe('getValue()', function() {
215235
it('should return "" when empty', function() {
216236
var test = setup_test('<select>', {});

0 commit comments

Comments
 (0)