Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Commit 5c1045e

Browse files
Add unit test for highlighting autocomplete cell on validation error
1 parent 89592e7 commit 5c1045e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/jasmine/spec/editors/autocompleteEditorSpec.js

+25
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,29 @@ describe('AutocompleteEditor', function () {
624624
expect(getDataAtCol(2)).toEqual(['yellow', 'red', 'blue']);
625625
});
626626

627+
it('should add class name `htInvalid` to a cell that does not validate - on validateCells', function () {
628+
var hot = handsontable({
629+
autoComplete: getAutocompleteConfig(false),
630+
data: [
631+
['yellow'],
632+
['red'],
633+
['blue']
634+
],
635+
validator: function (value, callb) {
636+
if (value == "yellow") {
637+
callb(false)
638+
}
639+
else {
640+
callb(true)
641+
}
642+
}
643+
});
644+
645+
hot.validateCells(function () {
646+
hot.render();
647+
});
648+
649+
expect(this.$container.find('td.htInvalid').length).toEqual(1);
650+
expect(this.$container.find('td:not(.htInvalid)').length).toEqual(2);
651+
});
627652
});

0 commit comments

Comments
 (0)