Skip to content

Commit 588c868

Browse files
anuragsimgekermportuga
authored andcommitted
fix(validate): missing getErrorMessages method
* Although it was defined in the service (and in the docs), it was never exposed in the grid API's validate object. * Fixes the ```validate.getErrorMessages is not a function``` error I was seeing. * Also added unit tests.
1 parent 3207b29 commit 588c868

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/features/validate/js/gridValidate.js

+2
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@
410410

411411
isInvalid: service.isInvalid,
412412

413+
getErrorMessages: service.getErrorMessages,
414+
413415
getFormattedErrors: service.getFormattedErrors,
414416

415417
getTitleFormattedErrors: service.getTitleFormattedErrors,

src/features/validate/test/uiGridValidateService.spec.js

+17
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,21 @@ describe('ui.grid.validate uiGridValidateService', function() {
229229
expect(uiGridValidateService.setValidator.calls.count()).toBe(3);
230230
});
231231
});
232+
233+
it('should initialize grid', function() {
234+
var scope = {};
235+
var grid = {
236+
api: {
237+
registerEventsFromObject: function() {},
238+
registerMethodsFromObject: function() {}
239+
}
240+
};
241+
242+
uiGridValidateService.initializeGrid(scope, grid);
243+
expect(grid.validate.isInvalid).toBeDefined();
244+
expect(grid.validate.getErrorMessages).toBeDefined();
245+
expect(grid.validate.getFormattedErrors).toBeDefined();
246+
expect(grid.validate.getTitleFormattedErrors).toBeDefined();
247+
expect(grid.validate.runValidators).toBeDefined();
248+
});
232249
});

0 commit comments

Comments
 (0)