2014-06-05 03:43:45 +00:00
|
|
|
assert = require 'assert'
|
|
|
|
clipboard = require 'clipboard'
|
2015-03-26 07:25:34 +00:00
|
|
|
nativeImage = require 'native-image'
|
|
|
|
path = require 'path'
|
2014-06-05 03:43:45 +00:00
|
|
|
|
|
|
|
describe 'clipboard module', ->
|
2015-03-26 07:25:34 +00:00
|
|
|
fixtures = path.resolve __dirname, 'fixtures'
|
|
|
|
|
|
|
|
describe 'clipboard.readImage()', ->
|
|
|
|
it 'returns NativeImage intance', ->
|
|
|
|
p = path.join fixtures, 'assets', 'logo.png'
|
|
|
|
i = nativeImage.createFromPath p
|
|
|
|
clipboard.writeImage p
|
|
|
|
assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
|
|
|
|
|
2014-06-05 03:43:45 +00:00
|
|
|
describe 'clipboard.readText()', ->
|
|
|
|
it 'returns unicode string correctly', ->
|
|
|
|
text = '千江有水千江月,万里无云万里天'
|
|
|
|
clipboard.writeText text
|
|
|
|
assert.equal clipboard.readText(), text
|