Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

84 linhas
2.5 KiB

  1. describe('Cell', function () {
  2. before(function () {
  3. cy.visit('/');
  4. });
  5. it('focuses cell on click', function () {
  6. cy.clickCell(2, 0)
  7. .should('have.class', 'dt-cell--focus');
  8. });
  9. it('not focuses cell which are not focusable', function () {
  10. cy.clickCell(1, 0)
  11. .should('not.have.class', 'dt-cell--focus');
  12. });
  13. it('edit cell on enter press', function () {
  14. cy.getCell(4, 0).type('{enter}')
  15. .should('have.class', 'dt-cell--editing')
  16. .type('{enter}')
  17. .should('not.have.class', 'dt-cell--editing');
  18. });
  19. it('edit cell on double click', function () {
  20. cy.getCell(4, 0)
  21. .as('target')
  22. .dblclick({ force: true })
  23. .should('have.class', 'dt-cell--editing');
  24. cy.clickCell(3, 0);
  25. cy.get('@target').should('not.have.class', 'dt-cell--editing');
  26. });
  27. it('edit cell', function () {
  28. cy.getCell(4, 1).dblclick({ force: true });
  29. cy.getCell(4, 1).find('input').click();
  30. cy.focused().type('{selectall}{del}Test{enter}');
  31. cy.getCell(4, 1).contains('Test');
  32. });
  33. it('if editing is false: editing should not activate', function () {
  34. cy.getCell(3, 0).dblclick({ force: true })
  35. .should('not.have.class', 'dt-cell--editing');
  36. });
  37. it('navigation using arrow keys', function () {
  38. cy.clickCell(2, 0)
  39. .type('{rightarrow}');
  40. cy.get('.dt-cell--focus')
  41. .should('have.class', 'dt-cell--3-0')
  42. .click({ force: true })
  43. .type('{downarrow}');
  44. cy.get('.dt-cell--focus')
  45. .should('have.class', 'dt-cell--3-1');
  46. // TODO: test navigation over hidden rows
  47. });
  48. it('navigation using ctrl + arrow keys', function () {
  49. cy.clickCell(2, 0)
  50. .type('{ctrl}{rightarrow}');
  51. cy.get('.dt-cell--focus')
  52. .should('have.class', 'dt-cell--7-0');
  53. });
  54. it('cell selection using shift + arrow keys', function () {
  55. cy.getCell(2, 1)
  56. .type('{shift}{rightarrow}{rightarrow}{downarrow}');
  57. // 6 cells and 2 headers
  58. cy.get('.dt-cell--highlight').should('have.length', 6 + 2);
  59. cy.clickCell(2, 0);
  60. });
  61. it('mouse selection', function () {
  62. // TODO:
  63. // cy.getCell(2, 1)
  64. // .trigger('mousedown', { which: 1, pageX: 331, pageY: 207, force: true })
  65. // .trigger('mousemove', { which: 1, pageX: 489, pageY: 312 })
  66. // .trigger('mouseup');
  67. });
  68. });