add failing spec
This commit is contained in:
parent
20d5a50ac9
commit
d426d4ad90
1 changed files with 20 additions and 0 deletions
|
@ -252,6 +252,9 @@ describe('session module', function () {
|
|||
var contentDisposition = 'inline; filename="mock.pdf"'
|
||||
var downloadFilePath = path.join(fixtures, 'mock.pdf')
|
||||
var downloadServer = http.createServer(function (req, res) {
|
||||
if (req.url === '/?testFilename') {
|
||||
contentDisposition = 'inline'
|
||||
}
|
||||
res.writeHead(200, {
|
||||
'Content-Length': mockPDF.length,
|
||||
'Content-Type': 'application/pdf',
|
||||
|
@ -320,6 +323,23 @@ describe('session module', function () {
|
|||
})
|
||||
})
|
||||
|
||||
it('can generate a default filename', function (done) {
|
||||
downloadServer.listen(0, '127.0.0.1', function () {
|
||||
var port = downloadServer.address().port
|
||||
ipcRenderer.sendSync('set-download-option', true, false)
|
||||
w.loadURL(url + ':' + port + '/?testFilename')
|
||||
ipcRenderer.once('download-done', function (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) {
|
||||
assert.equal(state, 'cancelled')
|
||||
assert.equal(filename, 'download.pdf')
|
||||
assert.equal(mimeType, 'application/pdf')
|
||||
assert.equal(receivedBytes, 0)
|
||||
assert.equal(totalBytes, mockPDF.length)
|
||||
assert.equal(disposition, contentDisposition)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('when a save path is specified and the URL is unavailable', function () {
|
||||
it('does not display a save dialog and reports the done state as interrupted', function (done) {
|
||||
ipcRenderer.sendSync('set-download-option', false, false)
|
||||
|
|
Loading…
Reference in a new issue