diff --git a/packages/grid/test/accessibility-polymer.test.js b/packages/grid/test/accessibility-polymer.test.js new file mode 100644 index 0000000000..d0132c10b4 --- /dev/null +++ b/packages/grid/test/accessibility-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './accessibility.common.js'; diff --git a/packages/grid/test/accessibility.test.js b/packages/grid/test/accessibility.common.js similarity index 99% rename from packages/grid/test/accessibility.test.js rename to packages/grid/test/accessibility.common.js index e4276dde31..3f65e8f022 100644 --- a/packages/grid/test/accessibility.test.js +++ b/packages/grid/test/accessibility.common.js @@ -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', () => { diff --git a/packages/grid/test/array-data-provider-polymer.test.js b/packages/grid/test/array-data-provider-polymer.test.js new file mode 100644 index 0000000000..59af804256 --- /dev/null +++ b/packages/grid/test/array-data-provider-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './array-data-provider.common.js'; diff --git a/packages/grid/test/array-data-provider.test.js b/packages/grid/test/array-data-provider.common.js similarity index 98% rename from packages/grid/test/array-data-provider.test.js rename to packages/grid/test/array-data-provider.common.js index ff8fdbea12..b0c662a595 100644 --- a/packages/grid/test/array-data-provider.test.js +++ b/packages/grid/test/array-data-provider.common.js @@ -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', () => { diff --git a/packages/grid/test/basic-polymer.test.js b/packages/grid/test/basic-polymer.test.js new file mode 100644 index 0000000000..dd340b6c36 --- /dev/null +++ b/packages/grid/test/basic-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './basic.common.js'; diff --git a/packages/grid/test/basic.test.js b/packages/grid/test/basic.common.js similarity index 99% rename from packages/grid/test/basic.test.js rename to packages/grid/test/basic.common.js index 858eebeeea..fd1cf90561 100644 --- a/packages/grid/test/basic.test.js +++ b/packages/grid/test/basic.common.js @@ -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, diff --git a/packages/grid/test/column-auto-width-polymer.test.js b/packages/grid/test/column-auto-width-polymer.test.js new file mode 100644 index 0000000000..49f817843d --- /dev/null +++ b/packages/grid/test/column-auto-width-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column-auto-width.common.js'; diff --git a/packages/grid/test/column-auto-width.test.js b/packages/grid/test/column-auto-width.common.js similarity index 99% rename from packages/grid/test/column-auto-width.test.js rename to packages/grid/test/column-auto-width.common.js index e50f71e18a..af50fb44fe 100644 --- a/packages/grid/test/column-auto-width.test.js +++ b/packages/grid/test/column-auto-width.common.js @@ -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', () => { diff --git a/packages/grid/test/column-group-polymer.test.js b/packages/grid/test/column-group-polymer.test.js new file mode 100644 index 0000000000..71032c498e --- /dev/null +++ b/packages/grid/test/column-group-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column-group.common.js'; diff --git a/packages/grid/test/column-group.test.js b/packages/grid/test/column-group.common.js similarity index 98% rename from packages/grid/test/column-group.test.js rename to packages/grid/test/column-group.common.js index 26ad68712c..819af1232b 100644 --- a/packages/grid/test/column-group.test.js +++ b/packages/grid/test/column-group.common.js @@ -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', () => { diff --git a/packages/grid/test/column-groups-polymer.test.js b/packages/grid/test/column-groups-polymer.test.js new file mode 100644 index 0000000000..76ec52bf5a --- /dev/null +++ b/packages/grid/test/column-groups-polymer.test.js @@ -0,0 +1,3 @@ +import '../vaadin-grid.js'; +import '../vaadin-grid-column-group.js'; +import './column-groups.common.js'; diff --git a/packages/grid/test/column-groups.test.js b/packages/grid/test/column-groups.common.js similarity index 99% rename from packages/grid/test/column-groups.test.js rename to packages/grid/test/column-groups.common.js index 0f25cec856..92b3a24680 100644 --- a/packages/grid/test/column-groups.test.js +++ b/packages/grid/test/column-groups.common.js @@ -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, diff --git a/packages/grid/test/column-polymer.test.js b/packages/grid/test/column-polymer.test.js new file mode 100644 index 0000000000..481374932d --- /dev/null +++ b/packages/grid/test/column-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column.common.js'; diff --git a/packages/grid/test/column-rendering-polymer.test.js b/packages/grid/test/column-rendering-polymer.test.js new file mode 100644 index 0000000000..3dad79f263 --- /dev/null +++ b/packages/grid/test/column-rendering-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column-rendering.common.js'; diff --git a/packages/grid/test/column-rendering.test.js b/packages/grid/test/column-rendering.common.js similarity index 99% rename from packages/grid/test/column-rendering.test.js rename to packages/grid/test/column-rendering.common.js index 538fcfa8fe..c9b144a3e1 100644 --- a/packages/grid/test/column-rendering.test.js +++ b/packages/grid/test/column-rendering.common.js @@ -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) => { diff --git a/packages/grid/test/column-reordering-polymer.test.js b/packages/grid/test/column-reordering-polymer.test.js new file mode 100644 index 0000000000..f7bfd7b2f3 --- /dev/null +++ b/packages/grid/test/column-reordering-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column-reordering.common.js'; diff --git a/packages/grid/test/column-reordering.test.js b/packages/grid/test/column-reordering.common.js similarity index 99% rename from packages/grid/test/column-reordering.test.js rename to packages/grid/test/column-reordering.common.js index d29ea74fbc..ebd3f00dfd 100644 --- a/packages/grid/test/column-reordering.test.js +++ b/packages/grid/test/column-reordering.common.js @@ -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, diff --git a/packages/grid/test/column-resizing-polymer.test.js b/packages/grid/test/column-resizing-polymer.test.js new file mode 100644 index 0000000000..6824c7d746 --- /dev/null +++ b/packages/grid/test/column-resizing-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './column-resizing.common.js'; diff --git a/packages/grid/test/column-resizing.test.js b/packages/grid/test/column-resizing.common.js similarity index 99% rename from packages/grid/test/column-resizing.test.js rename to packages/grid/test/column-resizing.common.js index d43262b991..b0a47f5dde 100644 --- a/packages/grid/test/column-resizing.test.js +++ b/packages/grid/test/column-resizing.common.js @@ -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, diff --git a/packages/grid/test/column.test.js b/packages/grid/test/column.common.js similarity index 99% rename from packages/grid/test/column.test.js rename to packages/grid/test/column.common.js index df193aa11e..e461db14db 100644 --- a/packages/grid/test/column.test.js +++ b/packages/grid/test/column.common.js @@ -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, diff --git a/packages/grid/test/data-provider-polymer.test.js b/packages/grid/test/data-provider-polymer.test.js new file mode 100644 index 0000000000..691bb423d3 --- /dev/null +++ b/packages/grid/test/data-provider-polymer.test.js @@ -0,0 +1,3 @@ +import './data-provider.styles.js'; +import '../all-imports.js'; +import './data-provider.common.js'; diff --git a/packages/grid/test/data-provider.test.js b/packages/grid/test/data-provider.common.js similarity index 99% rename from packages/grid/test/data-provider.test.js rename to packages/grid/test/data-provider.common.js index 42e9fa878e..88227c19a2 100644 --- a/packages/grid/test/data-provider.test.js +++ b/packages/grid/test/data-provider.common.js @@ -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, @@ -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` diff --git a/packages/grid/test/data-provider.styles.js b/packages/grid/test/data-provider.styles.js new file mode 100644 index 0000000000..73487c6211 --- /dev/null +++ b/packages/grid/test/data-provider.styles.js @@ -0,0 +1,10 @@ +import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; + +registerStyles( + 'vaadin-grid', + css` + [part~='cell'] { + height: 20px; + } + `, +); diff --git a/packages/grid/test/disabled-polymer.test.js b/packages/grid/test/disabled-polymer.test.js new file mode 100644 index 0000000000..e5f96be090 --- /dev/null +++ b/packages/grid/test/disabled-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './disabled.common.js'; diff --git a/packages/grid/test/disabled.test.js b/packages/grid/test/disabled.common.js similarity index 95% rename from packages/grid/test/disabled.test.js rename to packages/grid/test/disabled.common.js index 3d313dad48..15ff33aa38 100644 --- a/packages/grid/test/disabled.test.js +++ b/packages/grid/test/disabled.common.js @@ -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', () => { diff --git a/packages/grid/test/drag-and-drop-polymer.test.js b/packages/grid/test/drag-and-drop-polymer.test.js new file mode 100644 index 0000000000..b78798e6c2 --- /dev/null +++ b/packages/grid/test/drag-and-drop-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './drag-and-drop.common.js'; diff --git a/packages/grid/test/drag-and-drop.test.js b/packages/grid/test/drag-and-drop.common.js similarity index 99% rename from packages/grid/test/drag-and-drop.test.js rename to packages/grid/test/drag-and-drop.common.js index 9d6c40063c..5dbbc845cb 100644 --- a/packages/grid/test/drag-and-drop.test.js +++ b/packages/grid/test/drag-and-drop.common.js @@ -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', () => { diff --git a/packages/grid/test/dynamic-item-size-polymer.test.js b/packages/grid/test/dynamic-item-size-polymer.test.js new file mode 100644 index 0000000000..519b045e39 --- /dev/null +++ b/packages/grid/test/dynamic-item-size-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './dynamic-item-size.common.js'; diff --git a/packages/grid/test/dynamic-item-size.test.js b/packages/grid/test/dynamic-item-size.common.js similarity index 66% rename from packages/grid/test/dynamic-item-size.test.js rename to packages/grid/test/dynamic-item-size.common.js index a52c39abcb..279b30b669 100644 --- a/packages/grid/test/dynamic-item-size.test.js +++ b/packages/grid/test/dynamic-item-size.common.js @@ -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; @@ -31,6 +27,11 @@ describe('dynamic item size', () => { `); + // 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; }; diff --git a/packages/grid/test/event-context-polymer.test.js b/packages/grid/test/event-context-polymer.test.js new file mode 100644 index 0000000000..23eb1db785 --- /dev/null +++ b/packages/grid/test/event-context-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './event-context.common.js'; diff --git a/packages/grid/test/event-context.test.js b/packages/grid/test/event-context.common.js similarity index 98% rename from packages/grid/test/event-context.test.js rename to packages/grid/test/event-context.common.js index 0ba7e7f546..dffaf61339 100644 --- a/packages/grid/test/event-context.test.js +++ b/packages/grid/test/event-context.common.js @@ -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', () => { diff --git a/packages/grid/test/extension-polymer.test.js b/packages/grid/test/extension-polymer.test.js new file mode 100644 index 0000000000..b064aa1bb5 --- /dev/null +++ b/packages/grid/test/extension-polymer.test.js @@ -0,0 +1,2 @@ +import '../src/vaadin-grid.js'; +import './extension.common.js'; diff --git a/packages/grid/test/extension.test.js b/packages/grid/test/extension.common.js similarity index 92% rename from packages/grid/test/extension.test.js rename to packages/grid/test/extension.common.js index 22b4498651..47e72a492f 100644 --- a/packages/grid/test/extension.test.js +++ b/packages/grid/test/extension.common.js @@ -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', () => { diff --git a/packages/grid/test/filtering-polymer.test.js b/packages/grid/test/filtering-polymer.test.js new file mode 100644 index 0000000000..bd1a4a8849 --- /dev/null +++ b/packages/grid/test/filtering-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './filtering.common.js'; diff --git a/packages/grid/test/filtering.test.js b/packages/grid/test/filtering.common.js similarity index 98% rename from packages/grid/test/filtering.test.js rename to packages/grid/test/filtering.common.js index ec3bde2b7c..53377285e7 100644 --- a/packages/grid/test/filtering.test.js +++ b/packages/grid/test/filtering.common.js @@ -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'; diff --git a/packages/grid/test/frozen-columns-polymer.test.js b/packages/grid/test/frozen-columns-polymer.test.js new file mode 100644 index 0000000000..34fc19474d --- /dev/null +++ b/packages/grid/test/frozen-columns-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './frozen-columns.common.js'; diff --git a/packages/grid/test/frozen-columns.test.js b/packages/grid/test/frozen-columns.common.js similarity index 99% rename from packages/grid/test/frozen-columns.test.js rename to packages/grid/test/frozen-columns.common.js index 83133ffb6f..4445a211e4 100644 --- a/packages/grid/test/frozen-columns.test.js +++ b/packages/grid/test/frozen-columns.common.js @@ -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 { diff --git a/packages/grid/test/hidden-grid-polymer.test.js b/packages/grid/test/hidden-grid-polymer.test.js new file mode 100644 index 0000000000..e230c8f862 --- /dev/null +++ b/packages/grid/test/hidden-grid-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './hidden-grid.common.js'; diff --git a/packages/grid/test/hidden-grid.test.js b/packages/grid/test/hidden-grid.common.js similarity index 98% rename from packages/grid/test/hidden-grid.test.js rename to packages/grid/test/hidden-grid.common.js index 493d0abc2c..bee76968c9 100644 --- a/packages/grid/test/hidden-grid.test.js +++ b/packages/grid/test/hidden-grid.common.js @@ -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', () => { diff --git a/packages/grid/test/keyboard-navigation-cell-button-polymer.test.js b/packages/grid/test/keyboard-navigation-cell-button-polymer.test.js new file mode 100644 index 0000000000..83be3d32fd --- /dev/null +++ b/packages/grid/test/keyboard-navigation-cell-button-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './keyboard-navigation-cell-button.common.js'; diff --git a/packages/grid/test/keyboard-navigation-cell-button.test.js b/packages/grid/test/keyboard-navigation-cell-button.common.js similarity index 99% rename from packages/grid/test/keyboard-navigation-cell-button.test.js rename to packages/grid/test/keyboard-navigation-cell-button.common.js index 36c76cafa4..512bdd270e 100644 --- a/packages/grid/test/keyboard-navigation-cell-button.test.js +++ b/packages/grid/test/keyboard-navigation-cell-button.common.js @@ -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; diff --git a/packages/grid/test/keyboard-navigation-polymer.test.js b/packages/grid/test/keyboard-navigation-polymer.test.js new file mode 100644 index 0000000000..f91b700531 --- /dev/null +++ b/packages/grid/test/keyboard-navigation-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './keyboard-navigation.common.js'; diff --git a/packages/grid/test/keyboard-navigation-row-focus-polymer.test.js b/packages/grid/test/keyboard-navigation-row-focus-polymer.test.js new file mode 100644 index 0000000000..7d658df946 --- /dev/null +++ b/packages/grid/test/keyboard-navigation-row-focus-polymer.test.js @@ -0,0 +1,2 @@ +import '../src/all-imports.js'; +import './keyboard-navigation-row-focus.common.js'; diff --git a/packages/grid/test/keyboard-navigation-row-focus.test.js b/packages/grid/test/keyboard-navigation-row-focus.common.js similarity index 99% rename from packages/grid/test/keyboard-navigation-row-focus.test.js rename to packages/grid/test/keyboard-navigation-row-focus.common.js index 339c2d0a20..f5bafc0453 100644 --- a/packages/grid/test/keyboard-navigation-row-focus.test.js +++ b/packages/grid/test/keyboard-navigation-row-focus.common.js @@ -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; diff --git a/packages/grid/test/keyboard-navigation.test.js b/packages/grid/test/keyboard-navigation.common.js similarity index 99% rename from packages/grid/test/keyboard-navigation.test.js rename to packages/grid/test/keyboard-navigation.common.js index 8003539f4a..1e40be8589 100644 --- a/packages/grid/test/keyboard-navigation.test.js +++ b/packages/grid/test/keyboard-navigation.common.js @@ -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, diff --git a/packages/grid/test/light-dom-observing-polymer.test.js b/packages/grid/test/light-dom-observing-polymer.test.js new file mode 100644 index 0000000000..10e12c0a4a --- /dev/null +++ b/packages/grid/test/light-dom-observing-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './light-dom-observing.common.js'; diff --git a/packages/grid/test/light-dom-observing.test.js b/packages/grid/test/light-dom-observing.common.js similarity index 99% rename from packages/grid/test/light-dom-observing.test.js rename to packages/grid/test/light-dom-observing.common.js index 85aa440dbc..88d8c48010 100644 --- a/packages/grid/test/light-dom-observing.test.js +++ b/packages/grid/test/light-dom-observing.common.js @@ -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, diff --git a/packages/grid/test/lit-polymer.test.js b/packages/grid/test/lit-polymer.test.js new file mode 100644 index 0000000000..52c8679871 --- /dev/null +++ b/packages/grid/test/lit-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './lit.common.js'; diff --git a/packages/grid/test/lit-renderer-directives-polymer.test.js b/packages/grid/test/lit-renderer-directives-polymer.test.js new file mode 100644 index 0000000000..acfd540689 --- /dev/null +++ b/packages/grid/test/lit-renderer-directives-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './lit-renderer-directives.common.js'; diff --git a/packages/grid/test/lit-renderer-directives.test.js b/packages/grid/test/lit-renderer-directives.common.js similarity index 99% rename from packages/grid/test/lit-renderer-directives.test.js rename to packages/grid/test/lit-renderer-directives.common.js index b93f76bae1..dce402748c 100644 --- a/packages/grid/test/lit-renderer-directives.test.js +++ b/packages/grid/test/lit-renderer-directives.common.js @@ -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'; diff --git a/packages/grid/test/lit-renderers-polymer.test.js b/packages/grid/test/lit-renderers-polymer.test.js new file mode 100644 index 0000000000..6fa5f7d169 --- /dev/null +++ b/packages/grid/test/lit-renderers-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './lit-renderers.common.js'; diff --git a/packages/grid/test/lit-renderers.test.js b/packages/grid/test/lit-renderers.common.js similarity index 97% rename from packages/grid/test/lit-renderers.test.js rename to packages/grid/test/lit-renderers.common.js index aedcf17e8c..06c7f18825 100644 --- a/packages/grid/test/lit-renderers.test.js +++ b/packages/grid/test/lit-renderers.common.js @@ -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'; diff --git a/packages/grid/test/lit.test.js b/packages/grid/test/lit.common.js similarity index 96% rename from packages/grid/test/lit.test.js rename to packages/grid/test/lit.common.js index 59417421f5..1e75b8fc7b 100644 --- a/packages/grid/test/lit.test.js +++ b/packages/grid/test/lit.common.js @@ -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'; diff --git a/packages/grid/test/missing-imports-polymer.test.js b/packages/grid/test/missing-imports-polymer.test.js new file mode 100644 index 0000000000..611b72ef66 --- /dev/null +++ b/packages/grid/test/missing-imports-polymer.test.js @@ -0,0 +1,2 @@ +import '../src/vaadin-grid.js'; +import './missing-imports.common.js'; diff --git a/packages/grid/test/missing-imports.test.js b/packages/grid/test/missing-imports.common.js similarity index 98% rename from packages/grid/test/missing-imports.test.js rename to packages/grid/test/missing-imports.common.js index ade4e713e9..2a2d7a706f 100644 --- a/packages/grid/test/missing-imports.test.js +++ b/packages/grid/test/missing-imports.common.js @@ -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', () => { diff --git a/packages/grid/test/physical-count-polymer.test.js b/packages/grid/test/physical-count-polymer.test.js new file mode 100644 index 0000000000..ae69baedb8 --- /dev/null +++ b/packages/grid/test/physical-count-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './physical-count.common.js'; diff --git a/packages/grid/test/physical-count.test.js b/packages/grid/test/physical-count.common.js similarity index 81% rename from packages/grid/test/physical-count.test.js rename to packages/grid/test/physical-count.common.js index 98dd87889a..ff5b8e9de9 100644 --- a/packages/grid/test/physical-count.test.js +++ b/packages/grid/test/physical-count.common.js @@ -1,7 +1,6 @@ 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, getCellContent, @@ -11,25 +10,22 @@ import { infiniteDataProvider, } from './helpers.js'; -registerStyles( - 'vaadin-grid', - css` - :host { - font-size: 16px; - line-height: 1.5; - } - - :host(.small) [part~='cell'] { - line-height: 10px; - padding: 0 !important; - min-height: 0 !important; - } - - ::slotted(vaadin-grid-cell-content) { - padding: 0 !important; - } - `, -); +const styles = css` + :host { + font-size: 16px; + line-height: 1.5; + } + + :host(.small) [part~='cell'] { + line-height: 10px; + padding: 0 !important; + min-height: 0 !important; + } + + ::slotted(vaadin-grid-cell-content) { + padding: 0 !important; + } +`; describe('dynamic physical count', () => { let scroller, grid; @@ -40,6 +36,12 @@ describe('dynamic physical count', () => { `); + + // 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; }; diff --git a/packages/grid/test/renderers-polymer.test.js b/packages/grid/test/renderers-polymer.test.js new file mode 100644 index 0000000000..2291370586 --- /dev/null +++ b/packages/grid/test/renderers-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './renderers.common.js'; diff --git a/packages/grid/test/renderers.test.js b/packages/grid/test/renderers.common.js similarity index 99% rename from packages/grid/test/renderers.test.js rename to packages/grid/test/renderers.common.js index 8896a4de3b..5451ce4608 100644 --- a/packages/grid/test/renderers.test.js +++ b/packages/grid/test/renderers.common.js @@ -1,7 +1,6 @@ import { expect } from '@esm-bundle/chai'; import { fixtureSync, isIOS, keyDownOn } from '@vaadin/testing-helpers'; import sinon from 'sinon'; -import '../vaadin-grid.js'; import { flushGrid, getBodyCellContent, getCell, getContainerCell } from './helpers.js'; function getHeaderCell(grid, index = 0) { diff --git a/packages/grid/test/resizing-material-polymer.test.js b/packages/grid/test/resizing-material-polymer.test.js new file mode 100644 index 0000000000..8645968198 --- /dev/null +++ b/packages/grid/test/resizing-material-polymer.test.js @@ -0,0 +1,2 @@ +import '../theme/material/vaadin-grid.js'; +import './resizing-material.common.js'; diff --git a/packages/grid/test/resizing-material.test.js b/packages/grid/test/resizing-material.common.js similarity index 94% rename from packages/grid/test/resizing-material.test.js rename to packages/grid/test/resizing-material.common.js index 586bb08ba4..aa6b7fd4ee 100644 --- a/packages/grid/test/resizing-material.test.js +++ b/packages/grid/test/resizing-material.common.js @@ -1,6 +1,5 @@ import { expect } from '@esm-bundle/chai'; import { fixtureSync } from '@vaadin/testing-helpers'; -import '../theme/material/vaadin-grid.js'; import { flushGrid, infiniteDataProvider } from './helpers.js'; describe('resizing material grid', () => { diff --git a/packages/grid/test/resizing-polymer.test.js b/packages/grid/test/resizing-polymer.test.js new file mode 100644 index 0000000000..6aca71c384 --- /dev/null +++ b/packages/grid/test/resizing-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './resizing.common.js'; diff --git a/packages/grid/test/resizing.test.js b/packages/grid/test/resizing.common.js similarity index 99% rename from packages/grid/test/resizing.test.js rename to packages/grid/test/resizing.common.js index 8d794b9b57..2f362560e7 100644 --- a/packages/grid/test/resizing.test.js +++ b/packages/grid/test/resizing.common.js @@ -1,8 +1,6 @@ import { expect } from '@esm-bundle/chai'; import { aTimeout, fixtureSync, nextFrame, oneEvent } 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, diff --git a/packages/grid/test/row-details-polymer.test.js b/packages/grid/test/row-details-polymer.test.js new file mode 100644 index 0000000000..43ec461ce5 --- /dev/null +++ b/packages/grid/test/row-details-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './row-details.common.js'; diff --git a/packages/grid/test/row-details.test.js b/packages/grid/test/row-details.common.js similarity index 99% rename from packages/grid/test/row-details.test.js rename to packages/grid/test/row-details.common.js index 7a1552f2ae..3b5863c799 100644 --- a/packages/grid/test/row-details.test.js +++ b/packages/grid/test/row-details.common.js @@ -2,7 +2,6 @@ import { expect } from '@esm-bundle/chai'; import { aTimeout, click, fixtureSync, nextFrame } from '@vaadin/testing-helpers'; import sinon from 'sinon'; import '@polymer/polymer/lib/elements/dom-repeat.js'; -import '../vaadin-grid.js'; import { html, PolymerElement } from '@polymer/polymer/polymer-element.js'; import { buildDataSet, diff --git a/packages/grid/test/row-height-polymer.test.js b/packages/grid/test/row-height-polymer.test.js new file mode 100644 index 0000000000..b138a24d4e --- /dev/null +++ b/packages/grid/test/row-height-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './row-height.common.js'; diff --git a/packages/grid/test/row-height.test.js b/packages/grid/test/row-height.common.js similarity index 94% rename from packages/grid/test/row-height.test.js rename to packages/grid/test/row-height.common.js index a3ae6ec114..7c4be89b0b 100644 --- a/packages/grid/test/row-height.test.js +++ b/packages/grid/test/row-height.common.js @@ -1,18 +1,7 @@ import { expect } from '@esm-bundle/chai'; import { aTimeout, fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers'; -import '../vaadin-grid.js'; -import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; import { flushGrid, getRowCells, getRows, infiniteDataProvider, scrollToEnd } from './helpers.js'; -registerStyles( - 'vaadin-grid', - css` - [part~='cell'] { - border: none !important; - } - `, -); - const fixtures = { defaultContent: () => { const grid = fixtureSync(` diff --git a/packages/grid/test/scroll-restoration-polymer.test.js b/packages/grid/test/scroll-restoration-polymer.test.js new file mode 100644 index 0000000000..02e06e11f7 --- /dev/null +++ b/packages/grid/test/scroll-restoration-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './scroll-restoration.common.js'; diff --git a/packages/grid/test/scroll-restoration.test.js b/packages/grid/test/scroll-restoration.common.js similarity index 98% rename from packages/grid/test/scroll-restoration.test.js rename to packages/grid/test/scroll-restoration.common.js index 590d6ab1da..9cdafa1915 100644 --- a/packages/grid/test/scroll-restoration.test.js +++ b/packages/grid/test/scroll-restoration.common.js @@ -1,6 +1,5 @@ import { expect } from '@esm-bundle/chai'; import { aTimeout, fixtureSync, isFirefox } from '@vaadin/testing-helpers'; -import '../vaadin-grid.js'; import { fire, flushGrid, infiniteDataProvider } from './helpers.js'; if (isFirefox) { diff --git a/packages/grid/test/scroll-to-index-polymer.test.js b/packages/grid/test/scroll-to-index-polymer.test.js new file mode 100644 index 0000000000..5ed33de1b9 --- /dev/null +++ b/packages/grid/test/scroll-to-index-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './scroll-to-index.common.js'; diff --git a/packages/grid/test/scroll-to-index.test.js b/packages/grid/test/scroll-to-index.common.js similarity index 99% rename from packages/grid/test/scroll-to-index.test.js rename to packages/grid/test/scroll-to-index.common.js index fcf3473353..6a4925a10c 100644 --- a/packages/grid/test/scroll-to-index.test.js +++ b/packages/grid/test/scroll-to-index.common.js @@ -1,7 +1,5 @@ import { expect } from '@esm-bundle/chai'; import { fixtureSync, listenOnce, nextFrame, oneEvent } from '@vaadin/testing-helpers'; -import '../vaadin-grid.js'; -import '../vaadin-grid-tree-column.js'; import { flushGrid, getFirstVisibleItem, diff --git a/packages/grid/test/scrolling-mode-polymer.test.js b/packages/grid/test/scrolling-mode-polymer.test.js new file mode 100644 index 0000000000..d798f69acb --- /dev/null +++ b/packages/grid/test/scrolling-mode-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './scrolling-mode.common.js'; diff --git a/packages/grid/test/scrolling-mode.test.js b/packages/grid/test/scrolling-mode.common.js similarity index 99% rename from packages/grid/test/scrolling-mode.test.js rename to packages/grid/test/scrolling-mode.common.js index 7548c6ddee..50a8ab938e 100644 --- a/packages/grid/test/scrolling-mode.test.js +++ b/packages/grid/test/scrolling-mode.common.js @@ -1,6 +1,5 @@ import { expect } from '@esm-bundle/chai'; import { fixtureSync, isDesktopSafari, isFirefox, listenOnce, nextFrame, nextRender } from '@vaadin/testing-helpers'; -import '../vaadin-grid.js'; import { flushGrid, infiniteDataProvider, onceResized, scrollToEnd } from './helpers.js'; describe('scrolling mode', () => { diff --git a/packages/grid/test/selection-column-lazy-import.test.js b/packages/grid/test/selection-column-lazy-import-polymer.test.js similarity index 100% rename from packages/grid/test/selection-column-lazy-import.test.js rename to packages/grid/test/selection-column-lazy-import-polymer.test.js diff --git a/packages/grid/test/selection-polymer.test.js b/packages/grid/test/selection-polymer.test.js new file mode 100644 index 0000000000..e68306691e --- /dev/null +++ b/packages/grid/test/selection-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './selection.common.js'; diff --git a/packages/grid/test/selection.test.js b/packages/grid/test/selection.common.js similarity index 99% rename from packages/grid/test/selection.test.js rename to packages/grid/test/selection.common.js index cc0473f211..9a9968ac04 100644 --- a/packages/grid/test/selection.test.js +++ b/packages/grid/test/selection.common.js @@ -1,10 +1,6 @@ import { expect } from '@esm-bundle/chai'; import { click, fixtureSync, listenOnce, mousedown } from '@vaadin/testing-helpers'; import sinon from 'sinon'; -import '../vaadin-grid.js'; -import '../vaadin-grid-selection-column.js'; -import '../vaadin-grid-filter-column.js'; -import '../vaadin-grid-column-group.js'; import { fire, flushGrid, diff --git a/packages/grid/test/sorting-polymer.test.js b/packages/grid/test/sorting-polymer.test.js new file mode 100644 index 0000000000..a20f93c4de --- /dev/null +++ b/packages/grid/test/sorting-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './sorting.common.js'; diff --git a/packages/grid/test/sorting.test.js b/packages/grid/test/sorting.common.js similarity index 99% rename from packages/grid/test/sorting.test.js rename to packages/grid/test/sorting.common.js index 09fcdf6f03..e31496a727 100644 --- a/packages/grid/test/sorting.test.js +++ b/packages/grid/test/sorting.common.js @@ -1,9 +1,6 @@ import { expect } from '@esm-bundle/chai'; import { click, fixtureSync, keyUpOn, nextFrame } from '@vaadin/testing-helpers'; import sinon from 'sinon'; -import '../vaadin-grid-sorter.js'; -import '../vaadin-grid-sort-column.js'; -import { Grid } from '../vaadin-grid.js'; import { buildDataSet, flushGrid, @@ -14,6 +11,8 @@ import { shiftClick, } from './helpers.js'; +const Grid = customElements.get('vaadin-grid'); + describe('sorting', () => { describe('sorter', () => { let sorter, title, button, orderIndicator; diff --git a/packages/grid/test/styling-polymer.test.js b/packages/grid/test/styling-polymer.test.js new file mode 100644 index 0000000000..4e8e673646 --- /dev/null +++ b/packages/grid/test/styling-polymer.test.js @@ -0,0 +1,2 @@ +import '../vaadin-grid.js'; +import './styling.common.js'; diff --git a/packages/grid/test/styling.test.js b/packages/grid/test/styling.common.js similarity index 97% rename from packages/grid/test/styling.test.js rename to packages/grid/test/styling.common.js index 252802e539..81349e7267 100644 --- a/packages/grid/test/styling.test.js +++ b/packages/grid/test/styling.common.js @@ -1,7 +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 { flushGrid, getContainerCell, getRows, infiniteDataProvider, scrollToEnd } from './helpers.js'; describe('styling', () => { @@ -45,7 +44,7 @@ describe('styling', () => { it(`should remove old generated ${entries}`, () => { grid[generatorFn] = () => 'foo'; - grid[generatorFn] = () => 'bar'; + grid[generatorFn] = () => 'bar'; // NOSONAR assertCallback(['bar']); }); @@ -80,13 +79,13 @@ describe('styling', () => { it(`should clear generated ${entries} with falsy return value`, () => { grid[generatorFn] = () => 'foo'; - grid[generatorFn] = () => {}; + grid[generatorFn] = () => {}; // NOSONAR assertCallback([]); }); it(`should clear generated ${entries} with falsy property value`, () => { grid[generatorFn] = () => 'foo'; - grid[generatorFn] = undefined; + grid[generatorFn] = undefined; // NOSONAR assertCallback([]); }); diff --git a/packages/grid/test/tree-toggle-polymer.test.js b/packages/grid/test/tree-toggle-polymer.test.js new file mode 100644 index 0000000000..2fccc2ad8e --- /dev/null +++ b/packages/grid/test/tree-toggle-polymer.test.js @@ -0,0 +1,2 @@ +import '../all-imports.js'; +import './tree-toggle.common.js'; diff --git a/packages/grid/test/tree-toggle.test.js b/packages/grid/test/tree-toggle.common.js similarity index 98% rename from packages/grid/test/tree-toggle.test.js rename to packages/grid/test/tree-toggle.common.js index f45c41abc3..3067bf506e 100644 --- a/packages/grid/test/tree-toggle.test.js +++ b/packages/grid/test/tree-toggle.common.js @@ -1,9 +1,6 @@ import { expect } from '@esm-bundle/chai'; import { click, fixtureSync } from '@vaadin/testing-helpers'; import sinon from 'sinon'; -import '../vaadin-grid.js'; -import '../vaadin-grid-tree-toggle.js'; -import '../vaadin-grid-tree-column.js'; import { flushGrid, getBodyCellContent } from './helpers.js'; describe('tree toggle', () => {