This commit is contained in:
Guillermo 2018-11-23 22:44:40 -03:00
parent 80b6bcea8a
commit 6596e29d9c
2 changed files with 13 additions and 14 deletions

View File

@ -3,7 +3,7 @@ const TicketInfo = ReactMock();
const Table = ReactMock();
const Button = ReactMock();
const Tooltip = ReactMock();
const Dropdown = ReactMock();
const DepartmentDropdown = ReactMock();
const i18n = stub().returnsArg(0);
const TicketList = requireUnit('app-components/ticket-list', {
@ -11,7 +11,7 @@ const TicketList = requireUnit('app-components/ticket-list', {
'core-components/table': Table,
'core-components/button': Button,
'core-components/tooltip': Tooltip,
'core-components/drop-down': Dropdown,
'app-components/department-dropdown': DepartmentDropdown,
'lib-app/i18n': i18n
});
@ -54,7 +54,7 @@ describe('TicketList component', function () {
);
table = TestUtils.scryRenderedComponentsWithType(ticketList, Table);
dropdown = TestUtils.scryRenderedComponentsWithType(ticketList, Dropdown);
dropdown = TestUtils.scryRenderedComponentsWithType(ticketList, DepartmentDropdown);
}
it('should pass correct props to Table', function () {
@ -162,10 +162,10 @@ describe('TicketList component', function () {
});
it('should pass correct props to dropdown', function () {
expect(dropdown[0].props.items).to.deep.equal([
{content: i18n('ALL_DEPARTMENTS')},
{content: 'Sales Support'},
{content: 'Tech Help'}
expect(dropdown[0].props.departments).to.deep.equal([
{name: i18n('ALL_DEPARTMENTS')},
{name: 'Sales Support', id: 1},
{name: 'Tech Help', id: 2}
]);
expect(dropdown[0].props.size).to.equal('medium');
});

View File

@ -46,8 +46,7 @@ class TicketList extends React.Component {
return (
<div className="ticket-list">
<div className="ticket-list__filters">
{(this.props.type === 'secondary' && this.props.showDepartmentDropdown) ? this.renderDepartments
() : null}
{(this.props.type === 'secondary' && this.props.showDepartmentDropdown) ? this.renderDepartmentsDropDown() : null}
{this.props.onClosedTicketsShownChange ? this.renderFilterCheckbox() : null}
</div>
<Table {...this.getTableProps()} />