Add initial spec for clipboard.readBuffer
This commit is contained in:
parent
fe5db82d47
commit
0e55e5cbb5
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const {Buffer} = require('buffer')
|
||||||
|
|
||||||
const clipboard = require('electron').clipboard
|
const clipboard = require('electron').clipboard
|
||||||
const nativeImage = require('electron').nativeImage
|
const nativeImage = require('electron').nativeImage
|
||||||
|
@ -93,4 +94,14 @@ describe('clipboard module', function () {
|
||||||
assert.equal(clipboard.readFindText(), 'find this')
|
assert.equal(clipboard.readFindText(), 'find this')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('clipboard.readBuffer(format)', function () {
|
||||||
|
it('returns a Buffer of the content for the specified format', function () {
|
||||||
|
if (process.platform !== 'darwin') return
|
||||||
|
|
||||||
|
const buffer = Buffer.from('this is binary', 'utf8')
|
||||||
|
clipboard.writeText(buffer.toString())
|
||||||
|
assert(buffer.equals(clipboard.readBuffer('public.utf8-plain-text')))
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue