readOnly.e2e.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. describe('ContextMenuReadOnly', function () {
  2. var id = 'testContainer';
  3. beforeEach(function () {
  4. this.$container = $('<div id="' + id + '"></div>').appendTo('body');
  5. });
  6. afterEach(function () {
  7. if (this.$container) {
  8. destroy();
  9. this.$container.remove();
  10. }
  11. });
  12. it('should trigger `afterSetCellMeta` callback after changing cell to read only by context menu', function () {
  13. var afterSetCellMetaCallback = jasmine.createSpy('afterSetCellMetaCallback');
  14. var rows = 5,
  15. columns = 5;
  16. handsontable({
  17. data: Handsontable.helper.createSpreadsheetData(rows, columns),
  18. rowHeaders: true,
  19. colHeaders: true,
  20. contextMenu: true,
  21. afterSetCellMeta: afterSetCellMetaCallback
  22. });
  23. selectCell(2, 3);
  24. contextMenu();
  25. var changeToReadOnluButton = $('.htItemWrapper').filter(function () {
  26. return $(this).text() === 'Read only';
  27. })[0];
  28. $(changeToReadOnluButton).simulate('mousedown');
  29. expect(afterSetCellMetaCallback).toHaveBeenCalledWith(2, 3, 'readOnly', true, undefined, undefined);
  30. });
  31. });