Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk0493 committed Mar 5, 2021
2 parents 3259293 + a2d22c2 commit 8b5ee9d
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 126 deletions.
96 changes: 81 additions & 15 deletions cypress/integration/tests/additionalContent/cellEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
enableAdditionalContentConfig, enableAdditionalContentWithFlexRowConfig
} from '../../../../src/test/testEnvConfig';
import { constants } from '../../common/constants';
import { util } from 'chai';

const utils = new Utilities(enableAdditionalContentConfig);
const utilsFlexRow = new Utilities(enableAdditionalContentWithFlexRowConfig);
Expand Down Expand Up @@ -175,30 +176,95 @@ context('Cell editor position', () => {
].forEach(utilsFlexRow.testCellEditor.bind(utilsFlexRow));
});

it.skip('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => {
it('cell editor should be fully visible on double click on horizontally partially visible cell focus with additional flex content', () => { // ✅
visitAdditionalContentWithFlexRow();
utils.scrollTo(utilsFlexRow.getConfig().rgViewportWidth, 0);
utils.selectCell((utilsFlexRow.getConfig().cellWidth * 3) - 10, (utilsFlexRow.getConfig().cellHeight * 3) - 10);
utils.scrollTo(utilsFlexRow.getConfig().rgViewportWidth + utilsFlexRow.getConfig().cellWidth * 3 - utilsFlexRow.getCellXCenter(), 0);
utils.scrollTo(utils.getConfig().rgViewportWidth, 0);

utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(utils.getConfig().rgViewportWidth + utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(utils.getConfig().rgViewportWidth + utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollLeft);
expect(v.scrollLeft, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it('cell editor should be fully visible on double click on vertically partially visible cell focus with additional flex content', () => { // ✅
visitAdditionalContentWithFlexRow();
utils.scrollTo(utils.getConfig().rgViewportWidth, 0);

utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(utils.getConfig().rgViewportWidth, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(utils.getConfig().rgViewportWidth, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollTop);
expect(v.scrollTop, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});

it('cell editor should be fully visible on double click on horizontally partially visible cell focus with additional content', () => {
visitAdditionalContent();
utils.scrollTo(0, utils.getConfig().rgViewportHeight);

utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementLeftIsEqual(utils.getCellEditor(), utils.round(elementRect.left));
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), utils.getConfig().rgViewportHeight);
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), utils.getConfig().rgViewportHeight);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollLeft);
expect(v.scrollLeft, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it.skip('cell editor should be fully visible on double click on vertically partially visible cell focus', () => {
it('cell editor should be fully visible on double click on vertically partially visible cell focus with additional content', () => { // ✅
visitAdditionalContent();
utils.scrollTo(0, utils.getConfig().rgViewportHeight);

utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.scrollTo(0, utils.getConfig().rgViewportHeight + utils.getConfig().cellHeight * 3 - utils.getCellYCenter()); // -1 for MacOs tests
utils.getCellFocus().should('be.visible');
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
cy.wait(500);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementTopIsEqual(utils.getCellEditor(), utils.round(elementRect.top));
utils.scrollTo(0, utils.getConfig().rgViewportHeight + utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(0, utils.getConfig().rgViewportHeight + utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollTop);
expect(v.scrollTop, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});

Expand Down
51 changes: 30 additions & 21 deletions cypress/integration/tests/pinnedToBody/cellEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,32 +95,41 @@ context('Cell editor position', () => {
}].forEach(utils.testCellEditor.bind(utils));
});

it.skip('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 3, config.cellHeight * 3);
it('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
[
{
click: {
x: 0.1,
y: config.cellHeight * 3,
},
scroll: {
x: config.cellWidth * 3 - config.cellWidth / 2,
y: 0,
},
},
].forEach(utils.testCellEditor.bind(utils));
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

cy.window().its('scrollX').then($scrollLeft => {
const firstScrollValue = utils.round($scrollLeft);
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
cy.window().its('scrollX').then($scrollLeft2 => {
cy.wait(utils.wait());
const secondSrollValue = utils.round($scrollLeft2);
expect(firstScrollValue, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it.skip('cell editor should be fully visible on double click on vertically partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 3, config.cellHeight * 3);
it('cell editor should be fully visible on double click on vertically partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(0, config.cellHeight * 4 - utils.getCellYCenter());
utils.scrollTo(0, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementTopIsEqual(utils.getCellEditor(), utils.round(elementRect.top));
cy.window().its('scrollY').then($scrollTop => {
const firstScrollValue = utils.round($scrollTop);
utils.scrollTo(0, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
cy.window().its('scrollY').then($scrollTop2 => {
cy.wait(utils.wait());
const secondSrollValue = utils.round($scrollTop2);
expect(firstScrollValue, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});

Expand Down
70 changes: 39 additions & 31 deletions cypress/integration/tests/standard/cellEditor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { config } from '../../../../src/test/testEnvConfig';
import { Utilities } from '../../common/utils';
import { visit } from '../../common/visit';
import { constants } from '../../common/constants';


const utils = new Utilities(config);

Expand Down Expand Up @@ -42,8 +44,8 @@ context('Cell editor position', () => {
y: config.cellHeight * utils.getRandomInt(1, 15),
},
scroll: {
x: config.cellWidth * 20 + utils.getRandomInt(1, config.cellWidth),
y: config.cellHeight * 25 + utils.getRandomInt(1, config.cellHeight),
x: config.cellWidth * 20 + 21,
y: config.cellHeight * 25 + 5,
},
}
].forEach(utils.testCellEditor.bind(utils));
Expand Down Expand Up @@ -99,38 +101,44 @@ context('Cell editor position', () => {
].forEach(utils.testCellEditor.bind(utils));
});

it.skip('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => {
utils.selectCell((config.cellWidth * 3) - 10, (config.cellHeight * 3) - 10);
it('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
[
{
click: {
x: 0.1,
y: config.cellHeight * 3,
},
scroll: {
x: config.cellWidth * 3 - config.cellWidth / 2,
y: 0,
},
},
].forEach(utils.testCellEditor.bind(utils));
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(utils.getConfig().cellWidth * 3 - utils.getCellXCenter(), 0);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollLeft);
expect(v.scrollLeft, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it.skip('cell editor should be fully visible on double click on vertically partially visible cell focus', () => {
utils.selectCell((config.cellWidth * 3) - 10, (config.cellHeight * 3) - 10);
it('cell editor should be fully visible on double click on vertically partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
[
{
click: {
x: config.cellWidth * 3,
y: 0.1,
},
scroll: {
x: 0,
y: config.cellHeight * 3 - config.cellHeight / 2,
},
},
].forEach(utils.testCellEditor.bind(utils));
});
utils.scrollTo(0, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(0, utils.getConfig().cellHeight * 3 - utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollTop);
expect(v.scrollTop, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});
});
44 changes: 30 additions & 14 deletions cypress/integration/tests/sticky/cellEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,43 @@ context('Cell editor position', () => {
].forEach(utils.testCellEditorOnSticky.bind(utils));
});

it.skip('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 3, config.cellHeight * 3);
it('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(utils.getCellXCenter(), 0);

utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementLeftIsEqual(utils.getCellEditor(), utils.round(elementRect.left));
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(utils.getCellXCenter(), 0);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollLeft);
expect(v.scrollLeft, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it.skip('cell editor should be fully visible on double click on vertically partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 3, config.cellHeight * 3);
it('cell editor should be fully visible on double click on vertically partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(0, utils.getCellYCenter());

utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementTopIsEqual(utils.getCellEditor(), utils.round(elementRect.top));
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

utils.getScrollableElement().then($scrollable => {
const v = $scrollable[0];
utils.scrollTo(0, utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getScrollableElement().then($scrollable => {
const v2 = $scrollable[0];
cy.wait(utils.wait());
const secondSrollValue = utils.round(v2.scrollTop);
expect(v.scrollTop, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});

Expand Down
49 changes: 31 additions & 18 deletions cypress/integration/tests/stickyPinnedToBody/cellEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,41 @@ context('Cell editor position', () => {
].forEach(utils.testCellEditorOnSticky.bind(utils));
});

it.skip('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 4, config.cellHeight * 3);
it('cell editor should be fully visible on double click on horizontally partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 4) - 10, (utils.getConfig().cellHeight * 3) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(config.cellWidth / 2, 0);

utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementLeftIsEqual(utils.getCellEditor(), utils.round(elementRect.left));
utils.scrollTo(utils.getCellXCenter(), 0);
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowDown, { force: true }, 20, false);

cy.window().its('scrollX').then($scrollLeft => {
const firstScrollValue = utils.round($scrollLeft);
utils.scrollTo(utils.getCellXCenter(), 0);
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
cy.window().its('scrollX').then($scrollLeft2 => {
cy.wait(utils.wait());
const secondSrollValue = utils.round($scrollLeft2);
expect(firstScrollValue, 'Scroll left').to.be.equal(secondSrollValue);
});
});
});

it.skip('cell editor should be fully visible on double click on vertically partially visible cell focus', () => {
utils.selectCell(config.cellWidth * 4, config.cellHeight * 6);
it('cell editor should be fully visible on double click on vertically partially visible cell focus', () => { // ✅
utils.selectCell((utils.getConfig().cellWidth * 3) - 10, (utils.getConfig().cellHeight * 7) - 10);
utils.getCellFocus().should('be.visible');
utils.scrollTo(0, config.cellHeight * 1.5);

utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
utils.getCellEditor().then($el => {
const elementRect = $el[0].getBoundingClientRect();
utils.assertElementTopIsEqual(utils.getCellEditor(), utils.round(elementRect.top));
utils.scrollTo(0, utils.getConfig().cellHeight + utils.getCellYCenter());
cy.wait(utils.wait());
utils.keyDown(constants.keyCodes.ArrowRight, { force: true }, 20, false);

cy.window().its('scrollY').then($scrollTop => {
const firstScrollValue = utils.round($scrollTop);
utils.scrollTo(0, utils.getConfig().cellHeight + utils.getCellYCenter());
utils.keyDown(constants.keyCodes.Enter, { force: true }, 20, false);
cy.window().its('scrollY').then($scrollTop2 => {
cy.wait(utils.wait());
const secondSrollValue = utils.round($scrollTop2);
expect(firstScrollValue, 'Scroll Top').to.be.equal(secondSrollValue);
});
});
});

});
});
Loading

0 comments on commit 8b5ee9d

Please sign in to comment.