mirror of
https://github.com/atom/atom.git
synced 2026-02-12 07:35:14 -05:00
78 lines
2.0 KiB
CoffeeScript
78 lines
2.0 KiB
CoffeeScript
Buffer = require 'buffer'
|
|
fs = require 'fs'
|
|
require 'benchmark-helper'
|
|
$ = require 'jquery'
|
|
|
|
describe "editor.", ->
|
|
editor = null
|
|
|
|
beforeEach ->
|
|
window.rootViewParentSelector = '#jasmine-content'
|
|
spyOn(window, 'loadUserConfiguration')
|
|
window.startup()
|
|
editor = rootView.activeEditor()
|
|
|
|
afterEach ->
|
|
$(window).off 'beforeunload'
|
|
window.shutdown()
|
|
delete atom.rootViewStates[$windowNumber]
|
|
|
|
describe "empty-file.", ->
|
|
benchmark "insert-delete", ->
|
|
editor.insertText('x')
|
|
editor.backspace()
|
|
|
|
describe "300-line-file.", ->
|
|
beforeEach ->
|
|
editor.setBuffer new Buffer(require.resolve('fixtures/medium.coffee'))
|
|
|
|
describe "at-begining.", ->
|
|
benchmark "insert-delete", ->
|
|
editor.insertText('x')
|
|
editor.backspace()
|
|
|
|
benchmark "insert-delete-rehighlight", ->
|
|
editor.insertText('"')
|
|
editor.backspace()
|
|
|
|
describe "at-end.", ->
|
|
beforeEach ->
|
|
editor.moveCursorToBottom()
|
|
|
|
benchmark "insert-delete", ->
|
|
editor.insertText('"')
|
|
editor.backspace()
|
|
|
|
describe "9000-line-file.", ->
|
|
benchmark "opening.", 5, ->
|
|
editor.setBuffer new Buffer(require.resolve('fixtures/huge.js'))
|
|
|
|
describe "after-opening.", ->
|
|
beforeEach ->
|
|
editor.setBuffer new Buffer(require.resolve('fixtures/huge.js'))
|
|
|
|
benchmark "moving-to-eof.", 1, ->
|
|
editor.moveCursorToBottom()
|
|
|
|
describe "on-first-line.", ->
|
|
benchmark "inserting-newline", 5, ->
|
|
editor.insertNewline()
|
|
|
|
describe "on-last-visible-line.", ->
|
|
beforeEach ->
|
|
editor.setCursorScreenPosition([editor.getLastVisibleScreenRow(), 0])
|
|
|
|
benchmark "move-down-and-scroll", 300, ->
|
|
editor.trigger 'move-down'
|
|
|
|
describe "at-eof.", ->
|
|
endPosition = null
|
|
|
|
beforeEach ->
|
|
editor.moveCursorToBottom()
|
|
endPosition = editor.getCursorScreenPosition()
|
|
|
|
benchmark "move-to-beginning-of-word", ->
|
|
editor.moveCursorToBeginningOfWord()
|
|
editor.setCursorScreenPosition(endPosition)
|