Skip to content

Commit b198a34

Browse files
committed
Minor updates
1 parent ce3a061 commit b198a34

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

components/data-table/__tests__/data-table.browser-test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ describe('DataTable: ', function() {
374374
describe('Sortable', function() {
375375
afterEach(removeTable);
376376

377-
it('first clicked on sortable column header should result in ascending sort', function(done) {
377+
it('first clicked on sortable column header should result in ascending sort by default', function(done) {
378378
this.onSort = (data) => {
379379
data.property.should.equal('count');
380380
data.sortDirection.should.equal('asc');

components/data-table/private/header-cell.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ class DataTableHeaderCell extends React.Component {
104104
handleSort = (e) => {
105105
const oldSortDirection =
106106
this.props.sortDirection || this.state.sortDirection;
107-
// var sortDirection = this.props.firstSortDirection
108-
// if (oldSortDirection) {
109-
// sortDirection = oldSortDirection === 'asc' ? 'desc' : 'asc'
110-
// }
111-
const sortDirection = oldSortDirection ? (oldSortDirection === 'asc' ? 'desc' : 'asc') : (this.props.firstSortDirection)
107+
var sortDirection = this.props.firstSortDirection
108+
if (oldSortDirection) {
109+
sortDirection = oldSortDirection === 'asc' ? 'desc' : 'asc'
110+
}
112111
const data = {
113112
property: this.props.property,
114113
sortDirection,

0 commit comments

Comments
 (0)