-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from vaadin/feature/file-state
Expose state attributes on <vaadin-upload-file> host
- Loading branch information
Showing
3 changed files
with
93 additions
and
6 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
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,70 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>vaadin-upload tests</title> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
|
||
<link rel="import" href="common.html"> | ||
</head> | ||
|
||
<body> | ||
<test-fixture id="upload-file"> | ||
<template> | ||
<vaadin-upload-file></vaadin-upload-file> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
describe('<vaadin-upload-file> element', () => { | ||
let fileElement, fileObject; | ||
beforeEach(() => { | ||
fileElement = fixture('upload-file'); | ||
fileObject = createFile(100000, 'application/unknown'); | ||
fileElement.file = fileObject; | ||
}); | ||
|
||
describe('state attributes', () => { | ||
it('should not be uploading by default', () => { | ||
expect(fileElement.hasAttribute('uploading')).to.be.false; | ||
}); | ||
|
||
it('should reflect uploading', () => { | ||
fileElement.set('file.uploading', true); | ||
expect(fileElement.hasAttribute('uploading')).to.be.true; | ||
}); | ||
|
||
it('should not be indeterminate by default', () => { | ||
expect(fileElement.hasAttribute('indeterminate')).to.be.false; | ||
}); | ||
|
||
it('should reflect indeterminate', () => { | ||
fileElement.set('file.indeterminate', true); | ||
expect(fileElement.hasAttribute('indeterminate')).to.be.true; | ||
}); | ||
|
||
it('should not be complete by default', () => { | ||
expect(fileElement.hasAttribute('complete')).to.be.false; | ||
}); | ||
|
||
it('should reflect complete', () => { | ||
fileElement.set('file.complete', true); | ||
expect(fileElement.hasAttribute('complete')).to.be.true; | ||
}); | ||
|
||
it('should not be error by default', () => { | ||
expect(fileElement.hasAttribute('error')).to.be.false; | ||
}); | ||
|
||
it('should reflect error', () => { | ||
fileElement.set('file.error', true); | ||
expect(fileElement.hasAttribute('error')).to.be.true; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
window.VaadinUploadSuites = [ | ||
'upload.html', | ||
'adding-files.html', | ||
'file-list.html' | ||
'file-list.html', | ||
'file.html' | ||
]; |