Skip to content

Commit 637a2fe

Browse files
committed
Fix e2e footer tests
The values expected were wrong. Also added a promise handler before looking for expected values when entering a filter value. [skip ci]
1 parent 54af483 commit 637a2fe

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

misc/tutorial/105_footer.ngdoc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Total rows in the grid and the number of filtered rows. Selected rows will be s
88
<br/>
99
### Column Footer
1010
The grid also has column footer, which can be displayed if showColumnFooter option is set to true (default=false).
11-
You can set an aggregation function for each column or use a custom footer template to display
11+
You can set an aggregation function for each column or use a custom footer template to display
1212
what ever aggregation you wish.
1313
Aggregation functions supported are: sum, avg, row count, min, max.
1414
You need to inject the uiGridConstants in order to use aggregationTypes enum.
@@ -22,7 +22,7 @@ and grouping. In the case of pagination, you'll find that it gives you the tota
2222
which isn't intuitively what users would expect. With grouping it will give the total of the currently expanded
2323
data rows, which again may not be what users intuitively expect.
2424

25-
In the case of grouping the solution is to use the aggregation provided with grouping.
25+
In the case of grouping the solution is to use the aggregation provided with grouping.
2626

2727
<br/>
2828
You can override the default grid footer template with gridOptions.footerTemplate. Copy the default ui-grid-footer.html from the source as your starting point. <i>This is not demonstrated in this tutorial.</i>
@@ -106,11 +106,11 @@ You can override the default grid footer template with gridOptions.footerTemplat
106106
it('grid should have six visible columns', function () {
107107
gridTestUtils.expectHeaderColumnCount( 'grid1', 7 );
108108
});
109-
109+
110110
it('grid should have six visible columns in footer', function () {
111111
gridTestUtils.expectFooterColumnCount( 'grid1', 7 );
112112
});
113-
113+
114114
it('grid should have footers with specific values', function () {
115115
gridTestUtils.expectFooterCellValueMatch( 'grid1', 0, '' );
116116
gridTestUtils.expectFooterCellValueMatch( 'grid1', 1, 'total: 281568' );
@@ -121,17 +121,19 @@ You can override the default grid footer template with gridOptions.footerTemplat
121121
// gridTestUtils.expectFooterCellValueMatch( 'grid1', 6, 'max: ' + getMaxDateString() );
122122
// TODO: need to check item count, not done
123123
});
124-
124+
125125
it('filter and expect recalculate', function () {
126-
gridTestUtils.enterFilterInColumn( 'grid1', 1, '3' );
127-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 0, '' );
128-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 1, 'total: 19805' );
129-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 2, '29.375' );
130-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 3, 'min: 20' );
131-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 4, 'max: 39' );
132-
gridTestUtils.expectFooterCellValueMatch( 'grid1', 5, 'custom template' );
133-
// gridTestUtils.expectFooterCellValueMatch( 'grid1', 6, 'max: ' + getMaxDateString() );
134-
// TODO: need to check item count, not done
126+
gridTestUtils.enterFilterInColumn( 'grid1', 1, '3' )
127+
.then(function () {
128+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 0, '' );
129+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 1, 'total: 68974' );
130+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 2, '29.8978102189781' );
131+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 3, 'min: 20' );
132+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 4, 'max: 40' );
133+
gridTestUtils.expectFooterCellValueMatch( 'grid1', 5, 'custom template' );
134+
// gridTestUtils.expectFooterCellValueMatch( 'grid1', 6, 'max: ' + getMaxDateString() );
135+
// TODO: need to check item count, not done
136+
});
135137
});
136138
});
137139
</file>

test/e2e/gridTestUtils.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ module.exports = {
597597
enterFilterInColumn: function( gridId, colNumber, filterValue ) {
598598
var headerCell = this.headerCell( gridId, colNumber);
599599

600-
headerCell.element( by.css( '.ui-grid-filter-input' ) ).sendKeys(filterValue);
600+
return headerCell.element( by.css( '.ui-grid-filter-input' ) ).sendKeys(filterValue);
601601
},
602602

603603
/**
@@ -694,7 +694,7 @@ module.exports = {
694694

695695
gridMenuButton.element( by.repeater('item in menuItems').row( itemNumber) ).click();
696696
},
697-
697+
698698
/**
699699
* @ngdoc method
700700
* @methodOf ui.grid.e2eTestLibrary.api:gridTest
@@ -713,5 +713,5 @@ module.exports = {
713713
unclickGridMenu: function( gridId ) {
714714
var gridMenuButton = this.getGrid( gridId ).element( by.css ( '.ui-grid-menu-button' ) );
715715
gridMenuButton.click();
716-
}
717-
};
716+
}
717+
};

0 commit comments

Comments
 (0)