Skip to content

Commit 38713ba

Browse files
committed
Add gridObjectTestUtils.
Before: var gridTestUtils = require('lib/gridTestUtils.spec.js'); gridTestUtils.expectHeaderColumnCount('users-table', 6); gridTestUtils.expectHeaderCellValueMatch('users-table', 0, 'ID'); gridTestUtils.expectHeaderCellValueMatch('users-table', 1, 'Name'); gridTestUtils.expectHeaderCellValueMatch('users-table', 2, 'Email'); After: var GridObjectTest = require('lib/gridObjectTestUtils.spec.js'); var usersGrid = new GridObjectTest('users-table'); usersGrid.expectHeaderColumnCount(6); usersGrid.expectHeaderCellValueMatch(0, 'ID'); usersGrid.expectHeaderCellValueMatch(1, 'Name'); usersGrid.expectHeaderCellValueMatch(2, 'Email');
1 parent 7ba1a1a commit 38713ba

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/e2e/gridObjectTestUtils.spec.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* globals element, by */
2+
3+
var gridTestUtils = require('./gridTestUtils.spec.js');
4+
5+
function getProxyToRealMethod(gridId, method) {
6+
return function() {
7+
var callArgs = [gridId].concat(Array.prototype.slice.call(arguments));
8+
gridTestUtils[method].apply(gridTestUtils, callArgs);
9+
};
10+
}
11+
12+
/**
13+
* @ngdoc overview
14+
* @name ui.grid.e2eTestLibrary
15+
* @description
16+
* End to end test functions.
17+
*/
18+
19+
/**
20+
* @ngdoc service
21+
* @name ui.grid.e2eTestLibrary.api:gridTestObject
22+
* @description
23+
* End to end test functions.
24+
*/
25+
module.exports = function(gridId) {
26+
for (var method in gridTestUtils) {
27+
this[method] = getProxyToRealMethod(gridId, method);
28+
}
29+
};
30+

0 commit comments

Comments
 (0)