Choices/src/scripts/src/components/wrapped-select.test.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

import { expect } from 'chai';
2017-12-19 14:08:57 +01:00
import { stub } from 'sinon';
import WrappedElement from './wrapped-element';
import WrappedSelect from './wrapped-select';
import { DEFAULT_CLASSNAMES, DEFAULT_CONFIG } from '../constants';
2017-10-29 19:56:24 +01:00
describe('components/wrappedSelect', () => {
let instance;
let choicesInstance;
let choicesElement;
beforeEach(() => {
choicesInstance = {
config: {
...DEFAULT_CONFIG,
},
};
choicesElement = document.createElement('select');
instance = new WrappedSelect(choicesInstance, choicesElement, DEFAULT_CLASSNAMES);
});
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', () => {
// });
});