Skip to content

Commit 9476a11

Browse files
committed
fix!: change box-sizing to work in form-item
1 parent c448231 commit 9476a11

File tree

6 files changed

+80
-4
lines changed

6 files changed

+80
-4
lines changed

packages/upload/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"devDependencies": {
4444
"@esm-bundle/chai": "^4.3.4",
45+
"@vaadin/form-layout": "22.0.0-alpha10",
4546
"@vaadin/testing-helpers": "^0.3.0",
4647
"sinon": "^9.2.0"
4748
}

packages/upload/src/vaadin-upload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
6868
:host {
6969
display: block;
7070
position: relative;
71+
box-sizing: border-box;
7172
}
7273
7374
:host([hidden]) {
11.8 KB
Loading

packages/upload/test/visual/lumo/upload.test.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js';
22
import { sendKeys } from '@web/test-runner-commands';
33
import { visualDiff } from '@web/test-runner-visual-regression';
4+
import '@vaadin/form-layout/theme/lumo/vaadin-form-layout.js';
5+
import '@vaadin/form-layout/theme/lumo/vaadin-form-item.js';
46
import '../../../theme/lumo/vaadin-upload.js';
57

68
describe('upload', () => {
@@ -9,7 +11,6 @@ describe('upload', () => {
911
beforeEach(() => {
1012
div = document.createElement('div');
1113
div.style.padding = '10px';
12-
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
1314
});
1415

1516
['ltr', 'rtl'].forEach((dir) => {
@@ -18,6 +19,10 @@ describe('upload', () => {
1819
document.documentElement.setAttribute('dir', dir);
1920
});
2021

22+
beforeEach(() => {
23+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
24+
});
25+
2126
after(() => {
2227
document.documentElement.removeAttribute('dir');
2328
});
@@ -42,7 +47,8 @@ describe('upload', () => {
4247
});
4348

4449
describe('focus', () => {
45-
beforeEach(async () => {
50+
beforeEach(() => {
51+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
4652
element.files = [{ name: 'Don Quixote.pdf' }, { name: 'Hamlet.pdf', progress: 100, complete: true }];
4753
// To show the start button
4854
element.files[0].held = true;
@@ -97,11 +103,42 @@ describe('upload', () => {
97103
});
98104

99105
describe('states', () => {
106+
beforeEach(() => {
107+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
108+
});
109+
100110
it('max files reached', async () => {
101111
element.maxFiles = 1;
102112
element.files = [{ name: 'Don Quixote.pdf' }];
103113

104114
await visualDiff(div, 'state-max-files-reached');
105115
});
106116
});
117+
118+
describe('form-item', () => {
119+
beforeEach(() => {
120+
element = fixtureSync(
121+
`<vaadin-form-layout>
122+
<vaadin-upload></vaadin-upload>
123+
<vaadin-form-item>
124+
<label slot="label">Description</label>
125+
<textarea></textarea>
126+
</vaadin-form-item>
127+
<vaadin-form-item>
128+
<label slot="label">File</label>
129+
<vaadin-upload></vaadin-upload>
130+
</vaadin-form-item>
131+
<vaadin-form-item>
132+
<label slot="label">Description</label>
133+
<textarea></textarea>
134+
</vaadin-form-item>
135+
</vaadin-form-layout>`,
136+
div
137+
);
138+
});
139+
140+
it('form-item', async () => {
141+
await visualDiff(div, 'form-item');
142+
});
143+
});
107144
});
9.94 KB
Loading

packages/upload/test/visual/material/upload.test.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js';
22
import { sendKeys } from '@web/test-runner-commands';
33
import { visualDiff } from '@web/test-runner-visual-regression';
4+
import '@vaadin/form-layout/theme/material/vaadin-form-layout.js';
5+
import '@vaadin/form-layout/theme/material/vaadin-form-item.js';
46
import '../../../theme/material/vaadin-upload.js';
57

68
describe('upload', () => {
@@ -9,7 +11,6 @@ describe('upload', () => {
911
beforeEach(() => {
1012
div = document.createElement('div');
1113
div.style.padding = '10px';
12-
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
1314
});
1415

1516
['ltr', 'rtl'].forEach((dir) => {
@@ -18,6 +19,10 @@ describe('upload', () => {
1819
document.documentElement.setAttribute('dir', dir);
1920
});
2021

22+
beforeEach(() => {
23+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
24+
});
25+
2126
after(() => {
2227
document.documentElement.removeAttribute('dir');
2328
});
@@ -42,7 +47,8 @@ describe('upload', () => {
4247
});
4348

4449
describe('focus', () => {
45-
beforeEach(async () => {
50+
beforeEach(() => {
51+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
4652
element.files = [{ name: 'Don Quixote.pdf' }, { name: 'Hamlet.pdf', progress: 100, complete: true }];
4753
// To show the start button
4854
element.files[0].held = true;
@@ -97,11 +103,42 @@ describe('upload', () => {
97103
});
98104

99105
describe('states', () => {
106+
beforeEach(() => {
107+
element = fixtureSync('<vaadin-upload></vaadin-upload>', div);
108+
});
109+
100110
it('max files reached', async () => {
101111
element.maxFiles = 1;
102112
element.files = [{ name: 'Don Quixote.pdf' }];
103113

104114
await visualDiff(div, 'state-max-files-reached');
105115
});
106116
});
117+
118+
describe('form-item', () => {
119+
beforeEach(() => {
120+
element = fixtureSync(
121+
`<vaadin-form-layout>
122+
<vaadin-upload></vaadin-upload>
123+
<vaadin-form-item>
124+
<label slot="label">Description</label>
125+
<textarea></textarea>
126+
</vaadin-form-item>
127+
<vaadin-form-item>
128+
<label slot="label">File</label>
129+
<vaadin-upload></vaadin-upload>
130+
</vaadin-form-item>
131+
<vaadin-form-item>
132+
<label slot="label">Description</label>
133+
<textarea></textarea>
134+
</vaadin-form-item>
135+
</vaadin-form-layout>`,
136+
div
137+
);
138+
});
139+
140+
it('form-item', async () => {
141+
await visualDiff(div, 'form-item');
142+
});
143+
});
107144
});

0 commit comments

Comments
 (0)