Skip to content

Add pfSimpleSort directive with unit tests and ng-docs #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2015

Conversation

jeff-phillips-18
Copy link
Member

No description provided.

scope: {
config: '='
},
transclude: false,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this false by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I typically set it anyhow. I will remove though.

@waldenraines
Copy link

It would be nice if I could use the arrow keys and enter to select a filter. This would be a good opportunity to incorporate the onEnter directive I mentioned here.

</example>
*/
angular.module('patternfly.sort').directive('pfSimpleSort',
function ($document) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$document doesn't appear to be used anywhere.

@dtaylor113
Copy link
Member

LGTM

@jeff-phillips-18
Copy link
Member Author

Addressed the open issues. Let me know and I will squash before merge.

if ($scope.config.isAscending) {
iconClass = 'fa fa-sort-alpha-asc';
} else {
iconClass = 'fa fa-sort-alpha-desc';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using ng-class for these classes rather than having them in JS code? Sorry my comment wasn't specific enough before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 4 variations all which would check almost the same things. I thought it clearer to provide a function for this logic.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point and this way we can test it. Speaking of, I don't see any tests for this function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests check for the correct icon class after selecting different sort fields and directions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we don't want to unit test this explicitly? I expected a test for it since it's on the $scope and thus part of the API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jeff-phillips-18
Copy link
Member Author

Issue added for i18n support for icons in the direction button.
All other issues are addressed.
Squashed commits.

@waldenraines
Copy link

LGTM


.simple-sort .sort-direction {
font-size: 22px;
color: #222222;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the future just use #222 if everything is repeating.

dtaylor113 added a commit that referenced this pull request Sep 10, 2015
Add pfSimpleSort directive with unit tests and ng-docs
@dtaylor113 dtaylor113 merged commit b27eba1 into patternfly:master Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants