Skip to content

Commit

Permalink
Update example and tests to use sortBy props
Browse files Browse the repository at this point in the history
  • Loading branch information
louisbl committed Dec 4, 2018
1 parent 9812f57 commit 5ff475f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cypress/integration/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,23 @@ describe('List Page', () => {
ListPagePosts.toggleColumnSort('id');
cy.get(ListPagePosts.elements.sortBy('id')).get("svg").should('be.visible');

ListPagePosts.toggleColumnSort('tags');
cy.get(ListPagePosts.elements.sortBy('tags')).get("svg").should('be.visible');
ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("svg").should('be.visible');
});

it('should hide the sort arrow when clicking on another sortable column header', () => {
ListPagePosts.toggleColumnSort('published_at');
cy.get(ListPagePosts.elements.sortBy('id')).get("svg").should('be.hidden');
cy.get(ListPagePosts.elements.sortBy('tags')).get("svg").should('be.hidden');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("svg").should('be.hidden');
});

it('should reverse the sort arrow when clicking on an already sorted column header', () => {
ListPagePosts.toggleColumnSort('published_at');
ListPagePosts.toggleColumnSort('tags');
cy.get(ListPagePosts.elements.sortBy('tags')).get("[class*=iconDirectionAsc]").should('exist');
ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("[class*=iconDirectionAsc]").should('exist');

ListPagePosts.toggleColumnSort('tags');
cy.get(ListPagePosts.elements.sortBy('tags')).get("[class*=iconDirectionDesc]").should('exist');
ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("[class*=iconDirectionDesc]").should('exist');
});
})
});
1 change: 1 addition & 0 deletions examples/simple/src/posts/PostList.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const PostList = withStyles(styles)(({ classes, ...props }) => (
label="Tags"
reference="tags"
source="tags"
sortBy="tags.name"
cellClassName={classes.hiddenOnSmallScreens}
headerClassName={classes.hiddenOnSmallScreens}
>
Expand Down

0 comments on commit 5ff475f

Please sign in to comment.