mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Allow setting of invisibles on editor
This commit is contained in:
@@ -1522,13 +1522,14 @@ describe "Editor", ->
|
||||
describe "when editor.setShowInvisibles is called", ->
|
||||
it "displays spaces as •, tabs as ▸ and newlines as ¬ when true", ->
|
||||
editor.attachToDom()
|
||||
editor.setInvisibles(rootView.getInvisibles())
|
||||
editor.setText " a line with tabs\tand spaces "
|
||||
expect(editor.showInvisibles).toBeFalsy()
|
||||
expect(editor.find('.line').text()).toBe " a line with tabs and spaces "
|
||||
expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces "
|
||||
editor.setShowInvisibles(true)
|
||||
expect(editor.find('.line').text()).toBe "•a line with tabs▸ and spaces•¬"
|
||||
expect(editor.renderedLines.find('.line').text()).toBe "•a line with tabs▸ and spaces•¬"
|
||||
editor.setShowInvisibles(false)
|
||||
expect(editor.find('.line').text()).toBe " a line with tabs and spaces "
|
||||
expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces "
|
||||
|
||||
it "displays newlines(¬) as their own token outside of the other tokens scope", ->
|
||||
editor.setShowInvisibles(true)
|
||||
|
||||
@@ -715,13 +715,7 @@ describe "RootView", ->
|
||||
lowerRightEditor = rightEditor.splitDown()
|
||||
expect(lowerRightEditor.find(".line:first").text()).toBe " "
|
||||
|
||||
describe 'setInvisiblesMap', ->
|
||||
it 'sets the invisibles map to the supplied hash', ->
|
||||
rootView.setInvisiblesMap
|
||||
eol: "¬"
|
||||
space: "•"
|
||||
tab: "▸"
|
||||
|
||||
describe 'setInvisibles', ->
|
||||
it 'updates the display of all edit sessions with the new map', ->
|
||||
rootView.height(200)
|
||||
rootView.attachToDom()
|
||||
@@ -729,7 +723,7 @@ describe "RootView", ->
|
||||
rightEditor.setText(" \t ")
|
||||
leftEditor = rightEditor.splitLeft()
|
||||
|
||||
rootView.setInvisiblesMap
|
||||
rootView.setInvisibles
|
||||
eol: ";"
|
||||
space: "_"
|
||||
tab: "tab"
|
||||
@@ -737,14 +731,13 @@ describe "RootView", ->
|
||||
rootView.trigger "window:toggle-invisibles"
|
||||
expect(rightEditor.find(".line:first").text()).toBe "_tab _;"
|
||||
expect(leftEditor.find(".line:first").text()).toBe "_tab _;"
|
||||
# todo
|
||||
|
||||
describe 'getInvisiblesMap', ->
|
||||
describe 'getInvisibles', ->
|
||||
it 'contains an eol key with a value', ->
|
||||
expect(rootView.getInvisiblesMap().eol).toBe "¬"
|
||||
expect(rootView.getInvisibles().eol).toBe "¬"
|
||||
|
||||
it 'contains a space key with a value', ->
|
||||
expect(rootView.getInvisiblesMap().space).toBe "•"
|
||||
expect(rootView.getInvisibles().space).toBe "•"
|
||||
|
||||
it 'contains a tab key with a value', ->
|
||||
expect(rootView.getInvisiblesMap().tab).toBe "▸"
|
||||
expect(rootView.getInvisibles().tab).toBe "▸"
|
||||
|
||||
Reference in New Issue
Block a user