Exemplo n.º 1
0
 it('should not fire if `selectedIndex` is given the same as previous', function () {
     var select = new Select({ datasource: datasource, value: '2' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.setProperties({ selectedIndex: 1 });
     expect(spy).not.toHaveBeenCalled();
 });
Exemplo n.º 2
0
 it('should fire if `selectedIndex` is changed', function () {
     var select = new Select({ datasource: datasource, value: '2' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.setProperties({ selectedIndex: 2 });
     expect(spy).toHaveBeenCalled();
 });
Exemplo n.º 3
0
 it('should fire if `datasource` is changed even value is still available as previous', function () {
     var select = new Select({ datasource: datasource, value: '2' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.set('datasource', datasource.slice(0, 3));
     expect(spy).toHaveBeenCalled();
 });
Exemplo n.º 4
0
 it('should fire if `selectedIndex` is changed to an out-of-range value', function () {
     var select = new Select({ datasource: datasource, value: '2' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.set('selectedIndex', -1);
     expect(spy).toHaveBeenCalled();
 });
Exemplo n.º 5
0
 it('should fire if `rawValue` is changed to a non-exist value', function () {
     var select = new Select({ datasource: datasource, value: '2' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.set('rawValue', 'abc');
     expect(spy).toHaveBeenCalled();
 });
Exemplo n.º 6
0
 it('should fire if `datasource` is changed which causes `emptyText` to be selected', function () {
     var select = new Select({ datasource: datasource, value: '2', emptyText: 'test' });
     var spy = jasmine.createSpy();
     select.on('change', spy);
     select.appendTo(container);
     select.set('datasource', datasource.slice(3));
     expect(spy).toHaveBeenCalled();
 });