mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 16:08:24 +03:00
fd4b6c85ce
This metadata will be used to record the indentation level of the first line when copying multiple lines of text to the pasteboard. The pasteboard takes the md5 of the pasted content when writing, then when reading it associates the last written metadata only when the signature matches the previously written value.
18 lines
751 B
CoffeeScript
18 lines
751 B
CoffeeScript
describe "Pasteboard", ->
|
|
nativePasteboard = null
|
|
beforeEach ->
|
|
nativePasteboard = 'first'
|
|
spyOn($native, 'writeToPasteboard').andCallFake (text) -> nativePasteboard = text
|
|
spyOn($native, 'readFromPasteboard').andCallFake -> nativePasteboard
|
|
|
|
describe "write(text, metadata) and read()", ->
|
|
it "writes and reads text to/from the native pasteboard", ->
|
|
expect(pasteboard.read()).toEqual ['first']
|
|
pasteboard.write('next')
|
|
expect(nativePasteboard).toBe 'next'
|
|
|
|
it "returns metadata if the item on the native pasteboard matches the last written item", ->
|
|
pasteboard.write('next', {meta: 'data'})
|
|
expect(nativePasteboard).toBe 'next'
|
|
expect(pasteboard.read()).toEqual ['next', {meta: 'data'}]
|