Merge pull request #2144 from deepak1556/clipboard_multiwrite_patch
clipboard: api to write multiple formats to same writer
This commit is contained in:
commit
72f4884127
3 changed files with 61 additions and 1 deletions
|
@ -32,3 +32,21 @@ describe 'clipboard module', ->
|
|||
'<string>Hi</string>'
|
||||
clipboard.writeHtml text
|
||||
assert.equal clipboard.readHtml(), markup
|
||||
|
||||
describe 'clipboard.write()', ->
|
||||
it 'returns data correctly', ->
|
||||
text = 'test'
|
||||
p = path.join fixtures, 'assets', 'logo.png'
|
||||
i = nativeImage.createFromPath p
|
||||
markup =
|
||||
if process.platform is 'darwin'
|
||||
'<meta charset=\'utf-8\'><b>Hi</b>'
|
||||
else if process.platform is 'linux'
|
||||
'<meta http-equiv="content-type" ' +
|
||||
'content="text/html; charset=utf-8"><b>Hi</b>'
|
||||
else
|
||||
'<b>Hi</b>'
|
||||
clipboard.write {text: "test", html: '<b>Hi</b>', image: p}
|
||||
assert.equal clipboard.readText(), text
|
||||
assert.equal clipboard.readHtml(), markup
|
||||
assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue