Repository URL to install this package:
|
Version:
2.0.2 ▾
|
"use strict";
var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {
value: true
});
const react_test_renderer_1 = require("react-test-renderer");
const state_1 = require("../Select/state");
const SelectDropDown_1 = __importDefault(require("../SelectDropDown"));
const expectReactSnapshot = (Component, props) => {
const html = react_test_renderer_1.create(Component, props);
expect(html).toMatchSnapshot();
};
describe('DropDown', () => {
describe('views', () => {
it('renders with empty safely', () => {
const list = [];
expectReactSnapshot(SelectDropDown_1.default, {
list
});
}); // supports isSelected
it('renders with the list', () => {
const list = [{
isSelected: true,
label: '',
value: ''
}];
const html = react_test_renderer_1.create(SelectDropDown_1.default, {
list
});
expect(html).toMatchSnapshot();
});
});
describe('state', () => {
const list = [{
isSelected: true,
label: 'canada',
value: 'eh'
}];
const state = state_1.toMultiState({
list
});
it('can set the name', () => {
state.setLabel('canada');
expect(state.name).toEqual('canada');
});
it('can set the value', () => {
state.setValue('eh');
expect(state.value).toEqual('eh');
});
describe('actions', () => {
it('initially is hidden', () => {
expect(state.isVisible).toEqual(true);
});
it('should close the dropdown when you click an item', () => {
state.handleItemClick();
expect(state.value).toEqual('eh');
});
it('should handleFilterToggle', () => {
state.handleFilterToggle();
expect(state.isVisible).toEqual(true);
});
});
});
}); //# sourceMappingURL=SelectDropDown.test.js.map