2017-10-13 14:43:58 +02:00
|
|
|
import { expect } from 'chai';
|
2017-12-19 14:08:57 +01:00
|
|
|
import { stub } from 'sinon';
|
|
|
|
import WrappedElement from './wrapped-element';
|
2017-10-13 14:43:58 +02:00
|
|
|
import WrappedSelect from './wrapped-select';
|
|
|
|
import { DEFAULT_CLASSNAMES, DEFAULT_CONFIG } from '../constants';
|
|
|
|
|
2017-10-29 19:56:24 +01:00
|
|
|
describe('components/wrappedSelect', () => {
|
2017-10-13 14:43:58 +02:00
|
|
|
let instance;
|
|
|
|
let choicesInstance;
|
|
|
|
let choicesElement;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
choicesInstance = {
|
|
|
|
config: {
|
|
|
|
...DEFAULT_CONFIG,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
choicesElement = document.createElement('select');
|
|
|
|
instance = new WrappedSelect(choicesInstance, choicesElement, DEFAULT_CLASSNAMES);
|
|
|
|
});
|
2017-12-18 13:06:38 +01:00
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
document.body.innerHTML = '';
|
|
|
|
instance = null;
|
|
|
|
});
|
2017-12-19 14:08:57 +01:00
|
|
|
|
|
|
|
describe('inherited methods', () => {
|
|
|
|
['getElement', 'conceal', 'reveal', 'enable', 'disable'].forEach((method) => {
|
|
|
|
describe(method, () => {
|
|
|
|
it(`calls super.${method}`, () => {
|
|
|
|
stub(WrappedElement.prototype, method);
|
|
|
|
instance[method]();
|
|
|
|
expect(WrappedElement.prototype[method].called).to.equal(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// describe('getPlaceholderOption', () => {
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// describe('getOptions', () => {
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// describe('getOptionGroups', () => {
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// describe('setOptions', () => {
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// describe('appendDocFragment', () => {
|
|
|
|
|
|
|
|
// });
|
2017-10-13 14:43:58 +02:00
|
|
|
});
|