mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Add a bunch of specs for tabType setting
This commit is contained in:
@@ -3737,6 +3737,79 @@ describe "TextEditor", ->
|
||||
runs ->
|
||||
expect(editor.softTabs).toBe false
|
||||
|
||||
describe "when editor.tabType is 'hard'", ->
|
||||
beforeEach ->
|
||||
atom.config.set('editor.tabType', 'hard')
|
||||
|
||||
it "always chooses hard tabs and setSoftTabs() overrides the setting", ->
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.js').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
editor.setSoftTabs(true)
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample-with-tabs.coffee').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
editor.setSoftTabs(true)
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample-with-tabs-and-initial-comment.js').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
editor.setSoftTabs(true)
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open(null).then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
editor.setSoftTabs(true)
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
|
||||
describe "when editor.tabType is 'soft'", ->
|
||||
beforeEach ->
|
||||
atom.config.set('editor.tabType', 'soft')
|
||||
|
||||
it "always chooses soft tabs and setSoftTabs() overrides the setting", ->
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.js').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
editor.setSoftTabs(false)
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample-with-tabs.coffee').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
editor.setSoftTabs(false)
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample-with-tabs-and-initial-comment.js').then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
editor.setSoftTabs(false)
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open(null).then (editor) ->
|
||||
expect(editor.getSoftTabs()).toBe true
|
||||
editor.setSoftTabs(false)
|
||||
expect(editor.getSoftTabs()).toBe false
|
||||
|
||||
it "keeps the tabType when tokenization is complete", ->
|
||||
editor.destroy()
|
||||
|
||||
waitsForPromise ->
|
||||
atom.project.open('sample-with-tabs-and-leading-comment.coffee').then (o) -> editor = o
|
||||
|
||||
runs ->
|
||||
expect(editor.softTabs).toBe true
|
||||
|
||||
waitsForPromise ->
|
||||
atom.packages.activatePackage('language-coffee-script')
|
||||
|
||||
runs ->
|
||||
expect(editor.softTabs).toBe true
|
||||
|
||||
describe '.getTabLength()', ->
|
||||
describe 'when scoped settings are used', ->
|
||||
coffeeEditor = null
|
||||
|
||||
Reference in New Issue
Block a user