Skip to content

Commit

Permalink
fix(filterRow.html): header-class should also apply to filter row
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

A css class specified using the header-class will now be added to the filter row header cell and not
just the sorting row.

If you want to continue to apply the css rules *only* to the cell in the sorting header row you
will now need to qualify your css rule with the '.header' css class.

So the following:

```css
.my-customer-header {
    /* rules */
}
```

... will need to change to:

```css
.header.my-customer-header {
    /* rules */
}
```
  • Loading branch information
ccrowhurstram committed Sep 17, 2015
1 parent 52d99c5 commit eed6543
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ng-table/filterRow.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<tr ng-show="show_filter" class="ng-table-filters">
<th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if="$column.show(this)" class="filter"
<th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if="$column.show(this)" class="filter {{$column.class(this)}}"
ng-class="params.settings().filterOptions.filterLayout === 'horizontal' ? 'filter-horizontal' : ''">
<div ng-repeat="(name, filter) in $column.filter(this)" ng-include="config.getTemplateUrl(filter)" class="filter-cell"
ng-class="[getFilterCellCss($column.filter(this), params.settings().filterOptions.filterLayout), $last ? 'last' : '']">
Expand Down
29 changes: 20 additions & 9 deletions test/tableSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,28 @@ describe('ng-table', function() {
var rows = thead.find('tr');
var titles = angular.element(rows[0]).find('th');

expect(angular.element(titles[0]).hasClass('header')).toBeTruthy();
expect(angular.element(titles[1]).hasClass('header')).toBeTruthy();
expect(angular.element(titles[2]).hasClass('header')).toBeTruthy();
expect(angular.element(titles[0]).hasClass('header')).toBe(true);
expect(angular.element(titles[1]).hasClass('header')).toBe(true);
expect(angular.element(titles[2]).hasClass('header')).toBe(true);

expect(angular.element(titles[0]).hasClass('sortable')).toBeTruthy();
expect(angular.element(titles[1]).hasClass('sortable')).toBeTruthy();
expect(angular.element(titles[2]).hasClass('sortable')).toBeFalsy();
expect(angular.element(titles[0]).hasClass('sortable')).toBe(true);
expect(angular.element(titles[1]).hasClass('sortable')).toBe(true);
expect(angular.element(titles[2]).hasClass('sortable')).toBe(false);

expect(angular.element(titles[0]).hasClass('customClass')).toBeTruthy();
expect(angular.element(titles[1]).hasClass('customClass')).toBeTruthy();
expect(angular.element(titles[2]).hasClass('moneyHeaderClass')).toBeTruthy();
expect(angular.element(titles[0]).hasClass('customClass')).toBe(true);
expect(angular.element(titles[1]).hasClass('customClass')).toBe(true);
expect(angular.element(titles[2]).hasClass('moneyHeaderClass')).toBe(true);


var filterCells = angular.element(rows[1]).find('th');

expect(angular.element(filterCells[0]).hasClass('filter')).toBe(true);
expect(angular.element(filterCells[1]).hasClass('filter')).toBe(true);
expect(angular.element(filterCells[2]).hasClass('filter')).toBe(true);

expect(angular.element(filterCells[0]).hasClass('customClass')).toBe(true);
expect(angular.element(filterCells[1]).hasClass('customClass')).toBe(true);
expect(angular.element(filterCells[2]).hasClass('moneyHeaderClass')).toBe(true);
});

it('should create table header titles', function() {
Expand Down

0 comments on commit eed6543

Please sign in to comment.