Skip to content

Commit 3e0117f

Browse files
authored
test: move template tests to integration (#5492)
1 parent 89e1a1e commit 3e0117f

13 files changed

Lines changed: 62 additions & 68 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { expect } from '@esm-bundle/chai';
2+
import { fixtureSync } from '@vaadin/testing-helpers';
3+
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
4+
import '@vaadin/dialog';
5+
6+
describe('vaadin-dialog template', () => {
7+
let dialog, overlay;
8+
9+
beforeEach(() => {
10+
dialog = fixtureSync(`
11+
<vaadin-dialog>
12+
<template>foo</template>
13+
</vaadin-dialog>
14+
`);
15+
overlay = dialog.$.overlay;
16+
});
17+
18+
it('should render the template', () => {
19+
dialog.opened = true;
20+
expect(overlay.textContent).to.equal('foo');
21+
});
22+
});

packages/grid-pro/test/edit-column-template.test.js renamed to integration/tests/grid-pro-edit-column-template.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { expect } from '@esm-bundle/chai';
22
import { enter, esc, fixtureSync, space } from '@vaadin/testing-helpers';
33
import sinon from 'sinon';
44
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
5-
import '../vaadin-grid-pro.js';
6-
import '../vaadin-grid-pro-edit-column.js';
7-
import { createItems, dblclick, flushGrid, getCellEditor, getContainerCell } from './helpers.js';
5+
import '@vaadin/grid-pro/vaadin-grid-pro.js';
6+
import '@vaadin/grid-pro/vaadin-grid-pro-edit-column.js';
7+
import { createItems, dblclick, flushGrid, getCellEditor, getContainerCell } from '@vaadin/grid-pro/test/helpers.js';
88

99
describe('edit column template', () => {
1010
describe('default', () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sinon from 'sinon';
44
import '@polymer/polymer/lib/elements/dom-bind.js';
55
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
66
import '@vaadin/text-field/vaadin-text-field.js';
7-
import '../vaadin-grid.js';
7+
import '@vaadin/grid';
88
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
99
import {
1010
flushGrid,
@@ -14,7 +14,7 @@ import {
1414
getContainerCellContent,
1515
getFirstCell,
1616
infiniteDataProvider,
17-
} from './helpers.js';
17+
} from '@vaadin/grid/test/helpers.js';
1818

1919
class GridWithSlots extends PolymerElement {
2020
static get template() {

packages/notification/test/template.test.js renamed to integration/tests/notification-template.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@esm-bundle/chai';
22
import { fixtureSync } from '@vaadin/testing-helpers';
33
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
4-
import '../vaadin-notification.js';
4+
import '@vaadin/notification';
55
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
66

77
class XNotification extends PolymerElement {

packages/virtual-list/test/template.test.js renamed to integration/tests/virtual-list-template.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@esm-bundle/chai';
22
import { fixtureSync } from '@vaadin/testing-helpers';
33
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
4-
import '../vaadin-virtual-list.js';
4+
import '@vaadin/virtual-list';
55

66
describe('template', () => {
77
let list;

‎packages/dialog/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
},
4949
"devDependencies": {
5050
"@esm-bundle/chai": "^4.3.4",
51-
"@vaadin/polymer-legacy-adapter": "24.0.0-beta1",
5251
"@vaadin/testing-helpers": "^0.4.0",
5352
"@vaadin/text-area": "24.0.0-beta1",
5453
"lit": "^2.0.0",
Lines changed: 33 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,54 @@
11
import { expect } from '@esm-bundle/chai';
22
import { fixtureSync } from '@vaadin/testing-helpers';
33
import sinon from 'sinon';
4-
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
54
import '../vaadin-dialog.js';
65

76
describe('vaadin-dialog renderer', () => {
8-
describe('without template', () => {
9-
let dialog, overlay;
7+
let dialog, overlay;
108

11-
beforeEach(() => {
12-
dialog = fixtureSync('<vaadin-dialog></vaadin-dialog>');
13-
overlay = dialog.$.overlay;
14-
});
15-
16-
it('should render the content of renderer function when renderer function provided', () => {
17-
dialog.renderer = (root) => {
18-
const div = document.createElement('div');
19-
div.textContent = 'The content of the dialog';
20-
root.appendChild(div);
21-
};
22-
dialog.opened = true;
23-
24-
expect(overlay.textContent).to.include('The content of the dialog');
25-
});
26-
27-
it('should run renderers when requesting content update', () => {
28-
dialog.renderer = sinon.spy();
29-
dialog.opened = true;
30-
31-
expect(dialog.renderer.calledOnce).to.be.true;
9+
beforeEach(() => {
10+
dialog = fixtureSync('<vaadin-dialog></vaadin-dialog>');
11+
overlay = dialog.$.overlay;
12+
});
3213

33-
dialog.requestContentUpdate();
14+
it('should render the content of renderer function when renderer function provided', () => {
15+
dialog.renderer = (root) => {
16+
const div = document.createElement('div');
17+
div.textContent = 'The content of the dialog';
18+
root.appendChild(div);
19+
};
20+
dialog.opened = true;
3421

35-
expect(dialog.renderer.calledTwice).to.be.true;
36-
});
22+
expect(overlay.textContent).to.include('The content of the dialog');
23+
});
3724

38-
it('should not throw when requesting content update for an unupgraded dialog', () => {
39-
const dialog = document.createElement('vaadin-dialog');
25+
it('should run renderers when requesting content update', () => {
26+
dialog.renderer = sinon.spy();
27+
dialog.opened = true;
4028

41-
expect(() => dialog.requestContentUpdate()).not.to.throw();
42-
});
29+
expect(dialog.renderer.calledOnce).to.be.true;
4330

44-
it('should clear the content when removing the renderer', () => {
45-
dialog.renderer = (root) => {
46-
root.innerHTML = 'foo';
47-
};
48-
dialog.opened = true;
31+
dialog.requestContentUpdate();
4932

50-
expect(overlay.textContent).to.equal('foo');
33+
expect(dialog.renderer.calledTwice).to.be.true;
34+
});
5135

52-
dialog.renderer = null;
36+
it('should not throw when requesting content update for an unupgraded dialog', () => {
37+
const dialog = document.createElement('vaadin-dialog');
5338

54-
expect(overlay.textContent).to.equal('');
55-
});
39+
expect(() => dialog.requestContentUpdate()).not.to.throw();
5640
});
5741

58-
describe('with template', () => {
59-
let dialog, overlay;
42+
it('should clear the content when removing the renderer', () => {
43+
dialog.renderer = (root) => {
44+
root.innerHTML = 'foo';
45+
};
46+
dialog.opened = true;
47+
48+
expect(overlay.textContent).to.equal('foo');
6049

61-
beforeEach(() => {
62-
dialog = fixtureSync(`
63-
<vaadin-dialog>
64-
<template>foo</template>
65-
</vaadin-dialog>
66-
`);
67-
overlay = dialog.$.overlay;
68-
});
50+
dialog.renderer = null;
6951

70-
it('should render the template', () => {
71-
dialog.opened = true;
72-
expect(overlay.textContent).to.equal('foo');
73-
});
52+
expect(overlay.textContent).to.equal('');
7453
});
7554
});

‎packages/grid-pro/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
},
5454
"devDependencies": {
5555
"@esm-bundle/chai": "^4.3.4",
56-
"@vaadin/polymer-legacy-adapter": "24.0.0-beta1",
5756
"@vaadin/testing-helpers": "^0.4.0",
5857
"lit": "^2.0.0",
5958
"sinon": "^13.0.2"

‎packages/grid/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
},
5757
"devDependencies": {
5858
"@esm-bundle/chai": "^4.3.4",
59-
"@vaadin/polymer-legacy-adapter": "24.0.0-beta1",
6059
"@vaadin/testing-helpers": "^0.4.0",
6160
"lit": "^2.0.0",
6261
"sinon": "^13.0.2"

‎packages/grid/test/visual/lumo/grid.test.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { fixtureSync, nextRender } from '@vaadin/testing-helpers';
22
import { visualDiff } from '@web/test-runner-visual-regression';
3-
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
43
import '../../../theme/lumo/vaadin-grid.js';
54
import '../../../theme/lumo/vaadin-grid-column-group.js';
65
import '../../../theme/lumo/vaadin-grid-sorter.js';

0 commit comments

Comments
 (0)