Skip to content

Commit

Permalink
test: generate Lit test files automatically (#8561)
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen authored Jan 29, 2025
1 parent c1518f7 commit 91d99d2
Show file tree
Hide file tree
Showing 147 changed files with 112 additions and 263 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ packages/*/test/visual/screenshots/failed
packages/*/test/visual/*/screenshots/*/failed
packages/icons/test/visual/screenshots/failed

# Generated Lit test files
packages/*/test/*.generated.*

# Generated theme folders .ts files
packages/**/theme/**/*.d.ts

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"analyze": "polymer analyze packages/**/vaadin-*.js > analysis.json && node scripts/prepareDocs.js && node scripts/buildWebtypes.js && node scripts/generateLumoAutoCompleteCss.js && ./scripts/buildThemeTypings.sh",
"build:ts": "tsc --build tsconfig.build.json",
"debug": "web-test-runner --watch",
"debug:it": "web-test-runner --watch --config web-test-runner-it.config.js",
"debug": "yarn test --watch",
"debug:it": "yarn test --watch --config web-test-runner-it.config.js",
"dist": "rimraf dist && yarn analyze && rollup -c rollup.config.js && cp analysis.json dist",
"docs": "yarn analyze && web-dev-server --node-resolve --open",
"icons": "lerna run icons",
Expand All @@ -18,16 +18,16 @@
"prepare": "husky",
"serve:dist": "web-dev-server --app-index dist/index.html --open",
"start": "web-dev-server --node-resolve --open /dev",
"test": "web-test-runner",
"test:firefox": "web-test-runner --config web-test-runner-firefox.config.js",
"test:it": "web-test-runner --config web-test-runner-it.config.js",
"test:lumo": "web-test-runner --config web-test-runner-lumo.config.js",
"test:material": "web-test-runner --config web-test-runner-material.config.js",
"test:snapshots": "web-test-runner --config web-test-runner-snapshots.config.js",
"test:webkit": "web-test-runner --config web-test-runner-webkit.config.js",
"update:lumo": "TEST_ENV=update web-test-runner --config web-test-runner-lumo.config.js",
"update:material": "TEST_ENV=update web-test-runner --config web-test-runner-material.config.js",
"update:snapshots": "web-test-runner --config web-test-runner-snapshots.config.js --update-snapshots"
"test": "node scripts/generateLitTests.js && web-test-runner",
"test:firefox": "yarn test --config web-test-runner-firefox.config.js",
"test:it": "yarn test --config web-test-runner-it.config.js",
"test:lumo": "yarn test --config web-test-runner-lumo.config.js",
"test:material": "yarn test --config web-test-runner-material.config.js",
"test:snapshots": "yarn test --config web-test-runner-snapshots.config.js",
"test:webkit": "yarn test --config web-test-runner-webkit.config.js",
"update:lumo": "TEST_ENV=update yarn test --config web-test-runner-lumo.config.js",
"update:material": "TEST_ENV=update yarn test --config web-test-runner-material.config.js",
"update:snapshots": "yarn test --config web-test-runner-snapshots.config.js --update-snapshots"
},
"devDependencies": {
"@fontsource/roboto": "^4.5.8",
Expand Down
2 changes: 0 additions & 2 deletions packages/button/test/button-lit.test.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/button/test/button-polymer.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from '@vaadin/chai-plugins';
import { resetMouse, sendKeys, sendMouse } from '@vaadin/test-runner-commands';
import { fire, fixtureSync, middleOfNode, nextRender, nextUpdate } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-button.js';
import type { Button } from '../vaadin-button.js';

describe('vaadin-button', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/accessibility-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/accessibility-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import '../all-imports.js';
import { flushGrid } from './helpers.js';

describe('accessibility', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/array-data-provider-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/array-data-provider-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { click, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { flushGrid, getBodyCellContent, getRows } from './helpers.js';

describe('array data provider', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/basic-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/basic-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { aTimeout, fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import {
flushGrid,
getBodyCellContent,
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/column-auto-width-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-auto-width-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { aTimeout, fixtureSync, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { flushGrid, getContainerCell, getHeaderCell } from './helpers.js';

function getCellIntrinsicWidth(cell) {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/column-group-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-group-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { flushGrid, getContainerCell } from './helpers.js';

describe('column group', () => {
Expand Down
4 changes: 0 additions & 4 deletions packages/grid/test/column-groups-lit.test.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/grid/test/column-groups-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame, nextRender, nextResize } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import '../vaadin-grid-column-group.js';
import {
attributeRenderer,
flushGrid,
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/column-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-polymer.test.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/grid/test/column-rendering-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-rendering-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { aTimeout, fixtureSync, keyDownOn, nextFrame, nextResize, oneEvent } from '@vaadin/testing-helpers';
import Sinon from 'sinon';
import '../all-imports.js';
import { flushGrid, getCellContent, getHeaderCellContent } from './helpers.js';

['ltr', 'rtl'].forEach((dir) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/column-reordering-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-reordering-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { aTimeout, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
import {
attributeRenderer,
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/column-resizing-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/column-resizing-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, listenOnce, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import {
dragAndDropOver,
fire,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import {
flushGrid,
Expand Down
4 changes: 0 additions & 4 deletions packages/grid/test/data-provider-lit.test.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/grid/test/data-provider-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expect } from '@vaadin/chai-plugins';
import { aTimeout, fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import './data-provider.styles.js';
import '../all-imports.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import {
flushGrid,
Expand Down
2 changes: 0 additions & 2 deletions packages/grid/test/deprecated-api-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/deprecated-api-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { flushGrid } from './helpers.js';

describe('deprecated API', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/disabled-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/disabled-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { sendKeys } from '@vaadin/test-runner-commands';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import '../all-imports.js';
import { flushGrid } from './helpers.js';

describe('disabled', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/drag-and-drop-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/drag-and-drop-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from '@vaadin/chai-plugins';
import { resetMouse, sendMouse } from '@vaadin/test-runner-commands';
import { aTimeout, fixtureSync, listenOnce, nextFrame, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { hover } from '@vaadin/button/test/visual/helpers.js';
import { flushGrid, getBodyCellContent, getFirstCell, getRowBodyCells, getRows } from './helpers.js';

Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/dynamic-item-size-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/dynamic-item-size-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync } from '@vaadin/testing-helpers';
import '../vaadin-grid.js';
import { css } from 'lit';
import { flushGrid, getFirstVisibleItem, infiniteDataProvider } from './helpers.js';

Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/event-context-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/event-context-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@vaadin/chai-plugins';
import { click, fixtureSync } from '@vaadin/testing-helpers';
import '../all-imports.js';
import { flushGrid, getContainerCell } from './helpers.js';

describe('event context', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/grid/test/extension-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/extension-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
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
3 changes: 0 additions & 3 deletions packages/grid/test/filtering-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/filtering-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@vaadin/chai-plugins';
import { fire, fixtureSync, nextFrame, nextRender, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { html, LitElement } from 'lit';
import { flushGrid, getBodyCellContent, getHeaderCellContent, getVisibleItems, scrollToEnd } from './helpers.js';

Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/frozen-columns-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/frozen-columns-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from '@vaadin/chai-plugins';
import { resetMouse, sendMouse } from '@vaadin/test-runner-commands';
import { fixtureSync, listenOnce, nextRender, nextResize } from '@vaadin/testing-helpers';
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 { flushGrid, getRowCells, getRows, infiniteDataProvider, isWithinParentConstraints } from './helpers.js';
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/grid-wrapper-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/grid-wrapper-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@vaadin/chai-plugins';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import '../all-imports.js';
import { flushGrid, getBodyCellContent } from './helpers.js';

class GridWrapper extends HTMLElement {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/hidden-grid-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/hidden-grid-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from '@vaadin/chai-plugins';
import { sendKeys } from '@vaadin/test-runner-commands';
import { fixtureSync, nextFrame, nextRender, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-grid.js';
import { fire, flushGrid, getBodyCellContent, getHeaderCell, infiniteDataProvider } from './helpers.js';

describe('hidden grid', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/grid/test/keyboard-interaction-mode-lit.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/grid/test/keyboard-interaction-mode-polymer.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from '@vaadin/chai-plugins';
import { sendKeys } from '@vaadin/test-runner-commands';
import { aTimeout, fixtureSync, keyDownOn, nextFrame, nextRender } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../all-imports.js';
import { getDeepActiveElement } from '@vaadin/a11y-base/src/focus-utils.js';
import { flushGrid, getCellContent, getFocusedCellIndex, getFocusedRowIndex } from './helpers.js';

Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 91d99d2

Please sign in to comment.