mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
💄 Replace editor.getBuffer().getText() w/ editor.getText()
This commit is contained in:
parent
6d7a6f9a92
commit
b254fa39d9
@ -28,7 +28,7 @@ describe "Atom", ->
|
||||
expect(atom.windows.length).toBe previousWindowCount + 1
|
||||
newWindow = _.last(atom.windows)
|
||||
expect(newWindow.rootView.getActiveEditor().getPath()).toEqual filePath
|
||||
expect(newWindow.rootView.getActiveEditor().getBuffer().getText()).toEqual fs.read(filePath)
|
||||
expect(newWindow.rootView.getActiveEditor().getText()).toEqual fs.read(filePath)
|
||||
|
||||
describe ".windowOpened(window)", ->
|
||||
atom = null
|
||||
|
@ -61,7 +61,7 @@ describe "RootView", ->
|
||||
rootView = RootView.deserialize(viewState)
|
||||
expect(rootView.project.getPath()?).toBeFalsy()
|
||||
expect(rootView.getEditors().length).toBe 2
|
||||
expect(rootView.getActiveEditor().getBuffer().getText()).toBe buffer.getText()
|
||||
expect(rootView.getActiveEditor().getText()).toBe buffer.getText()
|
||||
expect(document.title).toBe 'untitled'
|
||||
|
||||
describe "when the serialized RootView has a project", ->
|
||||
|
@ -419,7 +419,7 @@ describe "Autocomplete", ->
|
||||
miniEditor.getBuffer().setText('foo')
|
||||
|
||||
autocomplete.detach()
|
||||
expect(miniEditor.getBuffer().getText()).toBe ''
|
||||
expect(miniEditor.getText()).toBe ''
|
||||
|
||||
editor.trigger 'move-down'
|
||||
expect(editor.getCursorBufferPosition().row).toBe 1
|
||||
|
@ -49,7 +49,7 @@ describe "CommandPanel", ->
|
||||
rootView.trigger 'command-panel:toggle'
|
||||
expect(rootView.find('.command-panel').view()).toBe commandPanel
|
||||
expect(commandPanel.miniEditor.isFocused).toBeTruthy()
|
||||
expect(commandPanel.miniEditor.getBuffer().getText()).toBe ''
|
||||
expect(commandPanel.miniEditor.getText()).toBe ''
|
||||
expect(commandPanel.miniEditor.getCursorScreenPosition()).toEqual [0, 0]
|
||||
|
||||
describe "when command-panel:repeat-relative-address is triggered on the root view", ->
|
||||
|
@ -24,7 +24,7 @@ describe "StripTrailingWhitespace", ->
|
||||
# works for buffers that are already open when extension is initialized
|
||||
editor.insertText("foo \nbar\t \n\nbaz")
|
||||
editor.save()
|
||||
expect(editor.getBuffer().getText()).toBe "foo\nbar\n\nbaz"
|
||||
expect(editor.getText()).toBe "foo\nbar\n\nbaz"
|
||||
|
||||
# works for buffers that are opened after extension is initialized
|
||||
rootView.open(require.resolve('fixtures/sample.txt'))
|
||||
@ -32,4 +32,4 @@ describe "StripTrailingWhitespace", ->
|
||||
editor.insertText(" ")
|
||||
|
||||
editor.getBuffer().save()
|
||||
expect(editor.getBuffer().getText()).toBe 'Some text.\n'
|
||||
expect(editor.getText()).toBe 'Some text.\n'
|
||||
|
@ -71,15 +71,15 @@ xdescribe "VimMode", ->
|
||||
editor.setCursorScreenPosition([0, 4])
|
||||
|
||||
editor.trigger keydownEvent('x')
|
||||
expect(editor.getBuffer().getText()).toBe '01235'
|
||||
expect(editor.getText()).toBe '01235'
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0, 4])
|
||||
|
||||
editor.trigger keydownEvent('x')
|
||||
expect(editor.getBuffer().getText()).toBe '0123'
|
||||
expect(editor.getText()).toBe '0123'
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0, 3])
|
||||
|
||||
editor.trigger keydownEvent('x')
|
||||
expect(editor.getBuffer().getText()).toBe '012'
|
||||
expect(editor.getText()).toBe '012'
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0, 2])
|
||||
|
||||
it "deletes nothing when cursor is on empty line", ->
|
||||
@ -87,7 +87,7 @@ xdescribe "VimMode", ->
|
||||
editor.setCursorScreenPosition [1, 0]
|
||||
|
||||
editor.trigger keydownEvent 'x'
|
||||
expect(editor.getBuffer().getText()).toBe "012345\n\nabcdef"
|
||||
expect(editor.getText()).toBe "012345\n\nabcdef"
|
||||
|
||||
describe "the d keybinding", ->
|
||||
describe "when followed by a d", ->
|
||||
@ -97,7 +97,7 @@ xdescribe "VimMode", ->
|
||||
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('d')
|
||||
expect(editor.getBuffer().getText()).toBe "12345\nABCDE"
|
||||
expect(editor.getText()).toBe "12345\nABCDE"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([1,0])
|
||||
|
||||
it "deletes the last line", ->
|
||||
@ -105,7 +105,7 @@ xdescribe "VimMode", ->
|
||||
editor.setCursorScreenPosition([2,1])
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('d')
|
||||
expect(editor.getBuffer().getText()).toBe "12345\nabcde"
|
||||
expect(editor.getText()).toBe "12345\nabcde"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([1,0])
|
||||
|
||||
xdescribe "when the second d is prefixed by a count", ->
|
||||
@ -117,7 +117,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('2')
|
||||
editor.trigger keydownEvent('d')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "12345\nQWERT"
|
||||
expect(editor.getText()).toBe "12345\nQWERT"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([1,0])
|
||||
|
||||
describe "when followed by an h", ->
|
||||
@ -128,13 +128,13 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent 'd'
|
||||
editor.trigger keydownEvent 'h'
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "abcd\n1234"
|
||||
expect(editor.getText()).toBe "abcd\n1234"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([1,0])
|
||||
|
||||
editor.trigger keydownEvent 'd'
|
||||
editor.trigger keydownEvent 'h'
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "abcd\n1234"
|
||||
expect(editor.getText()).toBe "abcd\n1234"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([1,0])
|
||||
|
||||
describe "when followed by a w", ->
|
||||
@ -145,7 +145,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('w')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "abefg"
|
||||
expect(editor.getText()).toBe "abefg"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0,2])
|
||||
|
||||
editor.getBuffer().setText("one two three four")
|
||||
@ -155,7 +155,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('3')
|
||||
editor.trigger keydownEvent('w')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "four"
|
||||
expect(editor.getText()).toBe "four"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0,0])
|
||||
|
||||
describe "when followed by a b", ->
|
||||
@ -166,7 +166,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('b')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "cd efg"
|
||||
expect(editor.getText()).toBe "cd efg"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0,0])
|
||||
|
||||
editor.getBuffer().setText("one two three four")
|
||||
@ -176,7 +176,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('3')
|
||||
editor.trigger keydownEvent('b')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe "ee four"
|
||||
expect(editor.getText()).toBe "ee four"
|
||||
expect(editor.getCursorScreenPosition()).toEqual([0,0])
|
||||
|
||||
describe "basic motion bindings", ->
|
||||
@ -293,7 +293,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('3')
|
||||
editor.trigger keydownEvent('x')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe '15'
|
||||
expect(editor.getText()).toBe '15'
|
||||
|
||||
editor.getBuffer().setText("123456789abc")
|
||||
editor.setCursorScreenPosition([0,0])
|
||||
@ -301,7 +301,7 @@ xdescribe "VimMode", ->
|
||||
editor.trigger keydownEvent('0')
|
||||
editor.trigger keydownEvent('x')
|
||||
|
||||
expect(editor.getBuffer().getText()).toBe 'bc'
|
||||
expect(editor.getText()).toBe 'bc'
|
||||
|
||||
describe "insert-mode", ->
|
||||
beforeEach ->
|
||||
|
@ -72,7 +72,7 @@ class FuzzyFinder extends View
|
||||
|
||||
populatePathList: ->
|
||||
@pathList.empty()
|
||||
for path in @findMatches(@miniEditor.getBuffer().getText())
|
||||
for path in @findMatches(@miniEditor.getText())
|
||||
@pathList.append $$ -> @li path
|
||||
|
||||
@pathList.children('li:first').addClass 'selected'
|
||||
|
Loading…
Reference in New Issue
Block a user