-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Tomi Virkki <[email protected]>
- Loading branch information
1 parent
00b7087
commit fdfbf61
Showing
10 changed files
with
258 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Upload</title> | ||
|
||
<script type="module"> | ||
import '@vaadin/upload'; | ||
|
||
const upload = document.querySelector('vaadin-upload'); | ||
upload.files = [ | ||
{ name: 'Annual Report.docx', complete: true }, | ||
{ | ||
name: 'Workflow.pdf', | ||
progress: 60, | ||
status: '19.7 MB: 60% (remaining time: 00:12:34)' | ||
}, | ||
{ name: 'Financials.xlsx', error: 'An error occurred' } | ||
]; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<vaadin-upload target="/api/fileupload"></vaadin-upload> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
packages/upload/test/dom/__snapshots__/vaadin-upload-file.test.snap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["vaadin-upload-file shadow default"] = | ||
`<div part="row"> | ||
<div part="info"> | ||
<div | ||
aria-hidden="true" | ||
hidden="" | ||
part="done-icon" | ||
> | ||
</div> | ||
<div | ||
aria-hidden="true" | ||
hidden="" | ||
part="warning-icon" | ||
> | ||
</div> | ||
<div part="meta"> | ||
<div | ||
id="name" | ||
part="name" | ||
> | ||
Workflow.pdf | ||
</div> | ||
<div | ||
id="status" | ||
part="status" | ||
> | ||
19.7 MB: 60% (remaining time: 00:12:34) | ||
</div> | ||
<div | ||
hidden="" | ||
id="error" | ||
part="error" | ||
> | ||
</div> | ||
</div> | ||
</div> | ||
<div part="commands"> | ||
<button | ||
aria-describedby="name" | ||
file-event="file-start" | ||
hidden="" | ||
part="start-button" | ||
type="button" | ||
> | ||
</button> | ||
<button | ||
aria-describedby="name" | ||
file-event="file-retry" | ||
hidden="" | ||
part="retry-button" | ||
type="button" | ||
> | ||
</button> | ||
<button | ||
aria-describedby="name" | ||
file-event="file-abort" | ||
part="remove-button" | ||
type="button" | ||
> | ||
</button> | ||
</div> | ||
</div> | ||
<vaadin-progress-bar | ||
aria-valuemax="1" | ||
aria-valuemin="0" | ||
aria-valuenow="0.6" | ||
id="progress" | ||
part="progress" | ||
role="progressbar" | ||
style="--vaadin-progress-value:0.6;" | ||
value="0.6" | ||
> | ||
</vaadin-progress-bar> | ||
`; | ||
/* end snapshot vaadin-upload-file shadow default */ | ||
|
77 changes: 77 additions & 0 deletions
77
packages/upload/test/dom/__snapshots__/vaadin-upload.test.snap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["vaadin-upload shadow default"] = | ||
`<div part="primary-buttons"> | ||
<div id="addFiles"> | ||
<slot name="add-button"> | ||
<vaadin-button | ||
id="addButton" | ||
part="upload-button" | ||
role="button" | ||
tabindex="0" | ||
> | ||
Upload Files... | ||
</vaadin-button> | ||
</slot> | ||
</div> | ||
<div | ||
id="dropLabelContainer" | ||
part="drop-label" | ||
> | ||
<slot name="drop-label-icon"> | ||
<div part="drop-label-icon"> | ||
</div> | ||
</slot> | ||
<slot | ||
id="dropLabel" | ||
name="drop-label" | ||
> | ||
Drop files here | ||
</slot> | ||
</div> | ||
</div> | ||
<slot name="file-list"> | ||
<ul | ||
id="fileList" | ||
part="file-list" | ||
> | ||
<li> | ||
<vaadin-upload-file | ||
complete="" | ||
tabindex="0" | ||
> | ||
</vaadin-upload-file> | ||
</li> | ||
<li> | ||
<vaadin-upload-file tabindex="0"> | ||
</vaadin-upload-file> | ||
</li> | ||
<li> | ||
<vaadin-upload-file | ||
error="" | ||
tabindex="0" | ||
> | ||
</vaadin-upload-file> | ||
</li> | ||
<dom-repeat | ||
as="file" | ||
style="display: none;" | ||
> | ||
<template is="dom-repeat"> | ||
</template> | ||
</dom-repeat> | ||
</ul> | ||
</slot> | ||
<slot> | ||
</slot> | ||
<input | ||
accept="" | ||
hidden="" | ||
id="fileInput" | ||
multiple="" | ||
type="file" | ||
> | ||
`; | ||
/* end snapshot vaadin-upload shadow default */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { fixtureSync } from '@vaadin/testing-helpers'; | ||
import '../../src/vaadin-upload-file.js'; | ||
|
||
describe('vaadin-upload-file', () => { | ||
let uploadFile; | ||
|
||
beforeEach(() => { | ||
uploadFile = fixtureSync('<vaadin-upload-file></vaadin-upload-file>'); | ||
uploadFile.file = { | ||
name: 'Workflow.pdf', | ||
progress: 60, | ||
status: '19.7 MB: 60% (remaining time: 00:12:34)' | ||
}; | ||
}); | ||
|
||
describe('shadow', () => { | ||
it('default', async () => { | ||
await expect(uploadFile).shadowDom.to.equalSnapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers'; | ||
import '../../src/vaadin-upload.js'; | ||
|
||
describe('vaadin-upload', () => { | ||
let upload; | ||
|
||
beforeEach(async () => { | ||
upload = fixtureSync('<vaadin-upload></vaadin-upload>'); | ||
upload.files = [ | ||
{ name: 'Annual Report.docx', complete: true }, | ||
{ | ||
name: 'Workflow.pdf', | ||
progress: 60, | ||
status: '19.7 MB: 60% (remaining time: 00:12:34)' | ||
}, | ||
{ name: 'Financials.xlsx', error: 'An error occurred' } | ||
]; | ||
await nextFrame(); | ||
}); | ||
|
||
describe('shadow', () => { | ||
it('default', async () => { | ||
await expect(upload).shadowDom.to.equalSnapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.