🎨 workspace-spec.js

This commit is contained in:
Max Brunsfeld
2017-12-01 09:46:46 -08:00
parent aaed3c744a
commit 49d8d94218

View File

@@ -1,5 +1,6 @@
const path = require('path')
const temp = require('temp').track()
const dedent = require('dedent')
const TextEditor = require('../src/text-editor')
const Workspace = require('../src/workspace')
const Project = require('../src/project')
@@ -1206,8 +1207,8 @@ describe('Workspace', () => {
})
})
describe('::onDidStopChangingActivePaneItem()', function () {
it('invokes observers when the active item of the active pane stops changing', function () {
describe('::onDidStopChangingActivePaneItem()', () => {
it('invokes observers when the active item of the active pane stops changing', () => {
const pane1 = atom.workspace.getCenter().getActivePane()
const pane2 = pane1.splitRight({items: [document.createElement('div'), document.createElement('div')]});
atom.workspace.getLeftDock().getActivePane().addItem(document.createElement('div'))
@@ -1364,7 +1365,7 @@ describe('Workspace', () => {
describe('::getActiveTextEditor()', () => {
describe("when the workspace center's active pane item is a text editor", () => {
describe('when the workspace center has focus', function () {
describe('when the workspace center has focus', () => {
it('returns the text editor', () => {
const workspaceCenter = workspace.getCenter()
const editor = new TextEditor()
@@ -1375,7 +1376,7 @@ describe('Workspace', () => {
})
})
describe('when a dock has focus', function () {
describe('when a dock has focus', () => {
it('returns the text editor', () => {
const workspaceCenter = workspace.getCenter()
const editor = new TextEditor()
@@ -1536,11 +1537,10 @@ describe('Workspace', () => {
waitsForPromise(() => atom.workspace.open('sample.coffee'))
runs(function () {
atom.workspace.getActiveTextEditor().setText(`\
i = /test/; #FIXME\
`
)
runs(() => {
atom.workspace.getActiveTextEditor().setText(dedent `
i = /test/; #FIXME\
`)
const atom2 = new AtomEnvironment({applicationDelegate: atom.applicationDelegate})
atom2.initialize({
@@ -2867,4 +2867,6 @@ i = /test/; #FIXME\
})
})
const escapeStringRegex = str => str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
function escapeStringRegex (string) {
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
}