mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 19:17:09 +03:00
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
/** @babel */
|
|
|
|
const TextEditor = require('../src/text-editor');
|
|
|
|
describe('WorkspaceCenter', () => {
|
|
describe('.observeTextEditors()', () => {
|
|
it('invokes the observer with current and future text editors', () => {
|
|
const workspaceCenter = atom.workspace.getCenter();
|
|
const pane = workspaceCenter.getActivePane();
|
|
const observed = [];
|
|
|
|
const editorAddedBeforeRegisteringObserver = new TextEditor();
|
|
const nonEditorItemAddedBeforeRegisteringObserver = document.createElement(
|
|
'div'
|
|
);
|
|
pane.activateItem(editorAddedBeforeRegisteringObserver);
|
|
pane.activateItem(nonEditorItemAddedBeforeRegisteringObserver);
|
|
|
|
workspaceCenter.observeTextEditors(editor => observed.push(editor));
|
|
|
|
const editorAddedAfterRegisteringObserver = new TextEditor();
|
|
const nonEditorItemAddedAfterRegisteringObserver = document.createElement(
|
|
'div'
|
|
);
|
|
pane.activateItem(editorAddedAfterRegisteringObserver);
|
|
pane.activateItem(nonEditorItemAddedAfterRegisteringObserver);
|
|
|
|
expect(observed).toEqual([
|
|
editorAddedBeforeRegisteringObserver,
|
|
editorAddedAfterRegisteringObserver
|
|
]);
|
|
});
|
|
});
|
|
});
|