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

View File

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