Add .contentType and .charset options for importFromFile()

And use them in new importTextAttachment() and importHTMLAttachment()
test support functions. These can be used to avoid needing a hidden
browser for determining the character set of the imported text
documents.
This commit is contained in:
Dan Stillman 2017-07-01 06:20:27 -04:00
parent b1fad5a310
commit 9a3ff2d244
3 changed files with 41 additions and 21 deletions

View file

@ -851,6 +851,16 @@ function importFileAttachment(filename, options = {}) {
}
function importTextAttachment() {
return importFileAttachment('test.txt', { contentType: 'text/plain', charset: 'utf-8' });
}
function importHTMLAttachment() {
return importFileAttachment('test.html', { contentType: 'text/html', charset: 'utf-8' });
}
/**
* Sets the fake XHR server to response to a given response
*