Fix TextEditor tests

This commit is contained in:
Max Brunsfeld
2017-11-20 16:49:56 -08:00
parent 6bf32b5ce8
commit aa1f5dde83
2 changed files with 4 additions and 15 deletions

View File

@@ -6613,17 +6613,6 @@ describe('TextEditor', () => {
})
})
describe('when the editor is constructed with the grammar option set', () => {
beforeEach(async () => {
await atom.packages.activatePackage('language-coffee-script')
})
it('sets the grammar', () => {
editor = new TextEditor({grammar: atom.grammars.grammarForScopeName('source.coffee')})
expect(editor.getGrammar().name).toBe('CoffeeScript')
})
})
describe('softWrapAtPreferredLineLength', () => {
it('soft wraps the editor at the preferred line length unless the editor is narrower or the editor is mini', () => {
editor.update({

View File

@@ -4437,10 +4437,10 @@ class TextEditor {
toggleLineCommentForBufferRow (row) { this.toggleLineCommentsForBufferRows(row, row) }
toggleLineCommentsForBufferRows (start, end) {
let {
commentStartString,
commentEndString
} = this.buffer.getLanguageMode().commentStringsForPosition(Point(start, 0))
const languageMode = this.buffer.getLanguageMode()
let {commentStartString, commentEndString} =
languageMode.commentStringsForPosition &&
languageMode.commentStringsForPosition(Point(start, 0)) || {}
if (!commentStartString) return
commentStartString = commentStartString.trim()