From 9cae4d3d8f31c303d87c3ef7e911af123ce2feee Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 2 Jul 2012 19:47:38 -0600 Subject: [PATCH] Rename RootView.editors -> getEditors --- spec/app/root-view-spec.coffee | 14 +++++++------- spec/app/window-spec.coffee | 2 +- src/app/root-view.coffee | 10 +++++----- src/app/status-bar.coffee | 2 +- src/extensions/autocomplete.coffee | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee index 1c1e0e51f..f31579a32 100644 --- a/spec/app/root-view-spec.coffee +++ b/spec/app/root-view-spec.coffee @@ -23,8 +23,8 @@ describe "RootView", -> describe "when pathToOpen references a file", -> it "creates a project for the file's parent directory, then sets the document.title and opens the file in an editor", -> expect(rootView.project.getPath()).toBe fs.directory(path) - expect(rootView.editors().length).toBe 1 - expect(rootView.editors()[0]).toHaveClass 'active' + expect(rootView.getEditors().length).toBe 1 + expect(rootView.getEditors()[0]).toHaveClass 'active' expect(rootView.getActiveEditor().buffer.getPath()).toBe path expect(rootView.getActiveEditor().editSessions.length).toBe 1 expect(document.title).toBe path @@ -39,7 +39,7 @@ describe "RootView", -> rootView.focus() expect(rootView.project.getPath()).toBe path - expect(rootView.editors().length).toBe 0 + expect(rootView.getEditors().length).toBe 0 expect(document.title).toBe path describe "when called with view state data returned from a previous call to RootView.prototype.serialize", -> @@ -60,7 +60,7 @@ describe "RootView", -> it "constructs the view with the same panes", -> rootView = RootView.deserialize(viewState) expect(rootView.project.getPath()?).toBeFalsy() - expect(rootView.editors().length).toBe 2 + expect(rootView.getEditors().length).toBe 2 expect(rootView.getActiveEditor().buffer.getText()).toBe buffer.getText() expect(document.title).toBe 'untitled' @@ -89,7 +89,7 @@ describe "RootView", -> rootView = RootView.deserialize(viewState) rootView.attachToDom() - expect(rootView.editors().length).toBe 4 + expect(rootView.getEditors().length).toBe 4 editor1 = rootView.panes.find('.row > .pane .editor:eq(0)').view() editor3 = rootView.panes.find('.row > .pane .editor:eq(1)').view() editor2 = rootView.panes.find('.row > .column > .pane .editor:eq(0)').view() @@ -120,7 +120,7 @@ describe "RootView", -> it "opens no buffer", -> rootView.remove() rootView = new RootView - expect(rootView.editors().length).toBe 0 + expect(rootView.getEditors().length).toBe 0 expect(document.title).toBe 'untitled' describe ".serialize()", -> @@ -497,7 +497,7 @@ describe "RootView", -> describe "when the last editor is removed", -> it "updates the title to the project path", -> - rootView.editors()[0].remove() + rootView.getEditors()[0].remove() expect(document.title).toBe rootView.project.getPath() describe "font size adjustment", -> diff --git a/spec/app/window-spec.coffee b/spec/app/window-spec.coffee index b3206eaad..e3e7d5a90 100644 --- a/spec/app/window-spec.coffee +++ b/spec/app/window-spec.coffee @@ -57,7 +57,7 @@ describe "Window", -> it "unsubscribes from all buffers", -> editor1 = rootView.getActiveEditor() editor2 = editor1.splitRight() - expect(window.rootView.editors().length).toBe 2 + expect(window.rootView.getEditors().length).toBe 2 $(window).trigger 'beforeunload' diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index da31a6f20..16016ebb5 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -112,7 +112,7 @@ class RootView extends View return true if allowActiveEditorChange - for editor in @editors() + for editor in @getEditors() if editor.activateEditSessionForPath(path) editor.focus() return true @@ -142,19 +142,19 @@ class RootView extends View setTitle: (title='untitled') -> document.title = title - editors: -> + getEditors: -> @panes.find('.editor').map(-> $(this).view()).toArray() modifiedBuffers: -> modifiedBuffers = [] - for editor in @editors() + for editor in @getEditors() for session in editor.editSessions modifiedBuffers.push session.buffer if session.buffer.isModified() modifiedBuffers getOpenBufferPaths: -> - _.uniq(_.flatten(@editors().map (editor) -> editor.getOpenBufferPaths())) + _.uniq(_.flatten(@getEditors().map (editor) -> editor.getOpenBufferPaths())) getActiveEditor: -> if (editor = @panes.find('.editor.active')).length @@ -182,7 +182,7 @@ class RootView extends View rootPane?.adjustDimensions() remove: -> - editor.remove() for editor in @editors() + editor.remove() for editor in @getEditors() @project.destroy() super diff --git a/src/app/status-bar.coffee b/src/app/status-bar.coffee index fd0c8aeb9..ca1007bae 100644 --- a/src/app/status-bar.coffee +++ b/src/app/status-bar.coffee @@ -5,7 +5,7 @@ class StatusBar extends View @activate: (rootView) -> requireStylesheet 'status-bar.css' - for editor in rootView.editors() + for editor in rootView.getEditors() @appendToEditorPane(rootView, editor) if rootView.parents('html').length rootView.on 'editor-open', (e, editor) => diff --git a/src/extensions/autocomplete.coffee b/src/extensions/autocomplete.coffee index 74f45c079..fcbe00573 100644 --- a/src/extensions/autocomplete.coffee +++ b/src/extensions/autocomplete.coffee @@ -25,7 +25,7 @@ class Autocomplete extends View originalSelectedText: null @activate: (rootView) -> - new Autocomplete(editor) for editor in rootView.editors() + new Autocomplete(editor) for editor in rootView.getEditors() rootView.on 'editor-open', (e, editor) -> new Autocomplete(editor) unless editor.is('.autocomplete .mini')