Skip to content

Commit

Permalink
test: split grid tests into common and import files (#6564)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki authored Sep 28, 2023
1 parent 7223786 commit 1d4eb25
Show file tree
Hide file tree
Showing 82 changed files with 139 additions and 130 deletions.
2 changes: 2 additions & 0 deletions packages/grid/test/accessibility-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './accessibility.common.js';
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import '../all-imports.js';
import { flushGrid } from './helpers.js';

describe('accessibility', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/array-data-provider-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './array-data-provider.common.js';
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { click, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-filter.js';
import '../vaadin-grid-sorter.js';
import { flushGrid, getBodyCellContent, getRows } from './helpers.js';

describe('array data provider', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/basic-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './basic.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import {
flushGrid,
getBodyCellContent,
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/column-auto-width-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column-auto-width.common.js';
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import '../vaadin-grid-tree-column.js';
import { flushGrid } from './helpers.js';

describe('column auto-width', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/column-group-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column-group.common.js';
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import { flushGrid, getContainerCell } from './helpers.js';

describe('column group', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/grid/test/column-groups-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import './column-groups.common.js';
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import {
attributeRenderer,
flushGrid,
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/column-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column.common.js';
2 changes: 2 additions & 0 deletions packages/grid/test/column-rendering-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column-rendering.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, keyDownOn, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import Sinon from 'sinon';
import '../vaadin-grid.js';
import { flushGrid, getCellContent, getHeaderCellContent, onceResized } from './helpers.js';

['ltr', 'rtl'].forEach((dir) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/column-reordering-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column-reordering.common.js';
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
import {
attributeRenderer,
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/column-resizing-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './column-resizing.common.js';
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, listenOnce, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import {
dragAndDropOver,
fire,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import {
flushGrid,
Expand Down
3 changes: 3 additions & 0 deletions packages/grid/test/data-provider-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './data-provider.styles.js';
import '../all-imports.js';
import './data-provider.common.js';
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import {
flushGrid,
getBodyCellContent,
Expand All @@ -20,15 +18,6 @@ import {
scrollToEnd,
} from './helpers.js';

registerStyles(
'vaadin-grid',
css`
[part~='cell'] {
height: 20px;
}
`,
);

class WrappedGrid extends PolymerElement {
static get template() {
return html`
Expand Down
10 changes: 10 additions & 0 deletions packages/grid/test/data-provider.styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

registerStyles(
'vaadin-grid',
css`
[part~='cell'] {
height: 20px;
}
`,
);
2 changes: 2 additions & 0 deletions packages/grid/test/disabled-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './disabled.common.js';
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync } from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import '../vaadin-grid.js';
import '../vaadin-grid-filter-column.js';
import '../vaadin-grid-sort-column.js';
import { flushGrid } from './helpers.js';

describe('disabled', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/drag-and-drop-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './drag-and-drop.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, listenOnce, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { flushGrid, getBodyCellContent, getFirstCell, getRowBodyCells, getRows } from './helpers.js';

describe('drag and drop', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/dynamic-item-size-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './dynamic-item-size.common.js';
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync } from '@vaadin/testing-helpers';
import '../vaadin-grid.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { css } from 'lit';
import { flushGrid, getFirstVisibleItem, infiniteDataProvider } from './helpers.js';

registerStyles(
'vaadin-grid',
css`
[part~='cell']:not([part~='details-cell']) ::slotted(vaadin-grid-cell-content) {
padding: 0 !important;
}
const styles = css`
[part~='cell']:not([part~='details-cell']) ::slotted(vaadin-grid-cell-content) {
padding: 0 !important;
}
[part~='cell'] {
padding: 1px;
line-height: 18px;
}
[part~='cell'] {
padding: 1px;
line-height: 18px;
}
:host(.high) [part~='cell'] {
line-height: 100px;
}
`,
);
:host(.high) [part~='cell'] {
line-height: 100px;
}
`;

describe('dynamic item size', () => {
let grid;
Expand All @@ -31,6 +27,11 @@ describe('dynamic item size', () => {
<vaadin-grid-column></vaadin-grid-column>
</vaadin-grid>
`);
// Inject the test styles
const style = document.createElement('style');
style.textContent = styles.cssText;
grid.shadowRoot.appendChild(style);

grid.querySelector('vaadin-grid-column').renderer = (root, _, model) => {
root.textContent = model.index;
};
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/event-context-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './event-context.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { click, fixtureSync } from '@vaadin/testing-helpers';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import { flushGrid, getContainerCell } from './helpers.js';

describe('event context', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/extension-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../src/vaadin-grid.js';
import './extension.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync } from '@vaadin/testing-helpers';
import { Grid } from '../src/vaadin-grid.js';

const Grid = customElements.get('vaadin-grid');
customElements.define('vaadin-custom-grid', class CustomGrid extends Grid {});

describe('extended grid', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/filtering-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './filtering.common.js';
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fire, fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-filter.js';
import '../vaadin-grid-filter-column.js';
import '../vaadin-grid-sorter.js';
import { html, LitElement } from 'lit';
import { flushGrid, getBodyCellContent, getHeaderCellContent, getVisibleItems, scrollToEnd } from './helpers.js';

Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/frozen-columns-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './frozen-columns.common.js';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { expect } from '@esm-bundle/chai';
import { fixtureSync, listenOnce, nextRender } from '@vaadin/testing-helpers';
import { resetMouse, sendMouse } from '@web/test-runner-commands';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js';
import { setNormalizedScrollLeft } from '@vaadin/component-base/src/dir-utils.js';
import {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/hidden-grid-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './hidden-grid.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { fire, flushGrid, getBodyCellContent, infiniteDataProvider } from './helpers.js';

describe('hidden grid', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './keyboard-navigation-cell-button.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { arrowLeft, arrowRight, aTimeout, fixtureSync } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { flushGrid } from './helpers.js';

let grid;
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/keyboard-navigation-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './keyboard-navigation.common.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../src/all-imports.js';
import './keyboard-navigation-row-focus.common.js';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
nextRender,
up as mouseUp,
} from '@vaadin/testing-helpers';
import '../src/all-imports.js';
import { flushGrid, getCellContent } from './helpers.js';

let grid, header, footer, body;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import {
} from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-tree-column.js';
import '../vaadin-grid-column-group.js';
import '../vaadin-grid-selection-column.js';
import { getDeepActiveElement } from '@vaadin/a11y-base/src/focus-utils.js';
import {
attributeRenderer,
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/light-dom-observing-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './light-dom-observing.common.js';
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import '../vaadin-grid-selection-column.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import {
attributeRenderer,
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/lit-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './lit.common.js';
2 changes: 2 additions & 0 deletions packages/grid/test/lit-renderer-directives-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './lit-renderer-directives.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { html, render } from 'lit';
import { columnBodyRenderer, columnFooterRenderer, columnHeaderRenderer, gridRowDetailsRenderer } from '../lit.js';
import { getCellContent, getContainerCell } from './helpers.js';
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/lit-renderers-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../all-imports.js';
import './lit-renderers.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync } from '@vaadin/testing-helpers';
import '../vaadin-grid.js';
import '../vaadin-grid-column.js';
import { html, render } from 'lit';
import { flushGrid } from './helpers.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync } from '@vaadin/testing-helpers';
import '../vaadin-grid-sort-column.js';
import '../vaadin-grid.js';
import { html, render } from 'lit';
import { getPhysicalItems } from './helpers.js';

Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/missing-imports-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../src/vaadin-grid.js';
import './missing-imports.common.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { flushGrid, infiniteDataProvider } from './helpers.js';

describe('missing imports', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/grid/test/physical-count-polymer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '../vaadin-grid.js';
import './physical-count.common.js';
Loading

0 comments on commit 1d4eb25

Please sign in to comment.