Skip to content

Commit 434104a

Browse files
author
Eleni Rundle
committed
Merge pull request #116 from jeff-phillips-18/master
Fixes #115 - makes pfSimpleSort direction toggle work in Firefox
2 parents 190b529 + 5ad9316 commit 434104a

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

dist/angular-patternfly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4759,7 +4759,7 @@ angular.module('patternfly.views').directive('pfDataToolbar',
47594759
'use strict';
47604760

47614761
$templateCache.put('sort/simple-sort.html',
4762-
"<div class=simple-sort><form><div class=form-group><div class=\"dropdown btn-group\"><button type=button class=\"btn btn-default dropdown-toggle\" data-toggle=dropdown aria-haspopup=true aria-expanded=false>{{config.currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\" ng-class=\"{'selected': item === config.currentField}\"><a class=sort-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><button class=\"btn btn-link\" type=button><span class=sort-direction ng-class=getSortIconClass() ng-click=changeDirection()></span></button></div></form></div>"
4762+
"<div class=simple-sort><form><div class=form-group><div class=\"dropdown btn-group\"><button type=button class=\"btn btn-default dropdown-toggle\" data-toggle=dropdown aria-haspopup=true aria-expanded=false>{{config.currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\" ng-class=\"{'selected': item === config.currentField}\"><a class=sort-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><button class=\"btn btn-link\" type=button ng-click=changeDirection()><span class=sort-direction ng-class=getSortIconClass()></span></button></div></form></div>"
47634763
);
47644764

47654765
}]);

dist/angular-patternfly.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sort/simple-sort.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</li>
1515
</ul>
1616
</div>
17-
<button class="btn btn-link" type="button">
18-
<span class="sort-direction" ng-class="getSortIconClass()" ng-click="changeDirection()"></span>
17+
<button class="btn btn-link" type="button" ng-click="changeDirection()">
18+
<span class="sort-direction" ng-class="getSortIconClass()"></span>
1919
</button>
2020
</div>
2121
</form>

test/sort/simple-sort.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ describe('Directive: pfSimpleSort', function () {
102102
});
103103

104104
it('should reverse the sort direction when the direction button is clicked', function () {
105+
var sortButton = element.find('.simple-sort .btn.btn-link');
105106
var sortIcon = element.find('.simple-sort .fa-sort-alpha-asc');
107+
expect(sortButton.length).toBe(1);
106108
expect(sortIcon.length).toBe(1);
107109

108-
eventFire(sortIcon[0], 'click');
110+
eventFire(sortButton[0], 'click');
109111
$scope.$digest();
110112

111113
sortIcon = element.find('.simple-sort .fa-sort-alpha-desc');
@@ -141,7 +143,7 @@ describe('Directive: pfSimpleSort', function () {
141143
var notified = false;
142144
var chosenField = '';
143145
var chosenDir = '';
144-
var sortIcon = element.find('.simple-sort .fa-sort-alpha-asc');
146+
var sortButton = element.find('.simple-sort .btn.btn-link');
145147

146148
var watchForNotify = function (sortField, isAscending) {
147149
notified = true;
@@ -151,9 +153,9 @@ describe('Directive: pfSimpleSort', function () {
151153

152154
$scope.sortConfig.onSortChange = watchForNotify;
153155

154-
expect(sortIcon.length).toBe(1);
156+
expect(sortButton.length).toBe(1);
155157

156-
eventFire(sortIcon[0], 'click');
158+
eventFire(sortButton[0], 'click');
157159
$scope.$digest();
158160

159161
expect(notified).toBeTruthy();

test/views/toolbar/data-toolbar.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,11 @@ describe('Directive: pfDataToolbar', function () {
389389

390390
it('should reverse the sort direction when the direction button is clicked', function () {
391391
var sortIcon = element.find('.simple-sort .fa-sort-alpha-asc');
392+
var sortButton = element.find('.simple-sort .btn.btn-link');
392393
expect(sortIcon.length).toBe(1);
394+
expect(sortButton.length).toBe(1);
393395

394-
eventFire(sortIcon[0], 'click');
396+
eventFire(sortButton[0], 'click');
395397
$scope.$digest();
396398

397399
sortIcon = element.find('.simple-sort .fa-sort-alpha-desc');
@@ -427,7 +429,7 @@ describe('Directive: pfDataToolbar', function () {
427429
var notified = false;
428430
var chosenField = '';
429431
var chosenDir = '';
430-
var sortIcon = element.find('.simple-sort .fa-sort-alpha-asc');
432+
var sortButton = element.find('.simple-sort .btn.btn-link');
431433

432434
var watchForNotify = function (sortField, isAscending) {
433435
notified = true;
@@ -437,9 +439,9 @@ describe('Directive: pfDataToolbar', function () {
437439

438440
$scope.config.sortConfig.onSortChange = watchForNotify;
439441

440-
expect(sortIcon.length).toBe(1);
442+
expect(sortButton.length).toBe(1);
441443

442-
eventFire(sortIcon[0], 'click');
444+
eventFire(sortButton[0], 'click');
443445
$scope.$digest();
444446

445447
expect(notified).toBeTruthy();

0 commit comments

Comments
 (0)