From ab6654bf34b33e852beb2739f4a7ff73a82fa9dc Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 18:30:08 -0500 Subject: [PATCH 01/11] Try to debug pane opening failures --- spec/settings-view-spec.coffee | 165 +++++++++++++++++---------------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index ca1ae780..4a9e5c48 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -199,106 +199,109 @@ describe "SettingsView", -> expect(atom.workspace.getActivePaneItem().activePanel) .toEqual name: 'Updates', options: uri: 'atom://config/updates' - describe "when atom.workspace.open() is used with a config URI", -> - focusIsWithinActivePanel = -> - activePanel = settingsView.panelsByName[settingsView.activePanel.name] - activePanel.element is document.activeElement or activePanel.element.contains(document.activeElement) - - expectActivePanelToBeKeyboardScrollable = -> - activePanel = settingsView.panelsByName[settingsView.activePanel.name] - spyOn(activePanel, 'pageDown') - atom.commands.dispatch(activePanel.element, 'core:page-down') - expect(activePanel.pageDown).toHaveBeenCalled() - spyOn(activePanel, 'pageUp') - atom.commands.dispatch(activePanel.element, 'core:page-up') - expect(activePanel.pageUp).toHaveBeenCalled() - - beforeEach -> - settingsView = null - - it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> - waitsForPromise -> - atom.workspace.open('atom://config').then (s) -> settingsView = s - - waitsFor (done) -> process.nextTick(done) - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Core', options: {} - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - - waitsForPromise -> - atom.workspace.open('atom://config/editor').then (s) -> settingsView = s + for i in [1..100] + describe "when atom.workspace.open() is used with a config URI #{i}", -> + focusIsWithinActivePanel = -> + activePanel = settingsView.panelsByName[settingsView.activePanel.name] + if activePanel.element isnt document.activeElement and not activePanel.element.contains(document.activeElement) + console.log document.activeElement + activePanel.element is document.activeElement or activePanel.element.contains(document.activeElement) + + expectActivePanelToBeKeyboardScrollable = -> + activePanel = settingsView.panelsByName[settingsView.activePanel.name] + spyOn(activePanel, 'pageDown') + atom.commands.dispatch(activePanel.element, 'core:page-down') + expect(activePanel.pageDown).toHaveBeenCalled() + spyOn(activePanel, 'pageUp') + atom.commands.dispatch(activePanel.element, 'core:page-up') + expect(activePanel.pageUp).toHaveBeenCalled() + + beforeEach -> + settingsView = null + + it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> + waitsForPromise -> + atom.workspace.open('atom://config').then (s) -> settingsView = s - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Editor', options: uri: 'atom://config/editor' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + waitsFor (done) -> process.nextTick(done) + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Core', options: {} + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s + waitsForPromise -> + atom.workspace.open('atom://config/editor').then (s) -> settingsView = s - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Editor', options: uri: 'atom://config/editor' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/packages').then (s) -> settingsView = s + waitsForPromise -> + atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Packages', options: uri: 'atom://config/packages' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/themes').then (s) -> settingsView = s + waitsForPromise -> + atom.workspace.open('atom://config/packages').then (s) -> settingsView = s - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Themes', options: uri: 'atom://config/themes' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Packages', options: uri: 'atom://config/packages' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/updates').then (s) -> settingsView = s + waitsForPromise -> + atom.workspace.open('atom://config/themes').then (s) -> settingsView = s - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Updates', options: uri: 'atom://config/updates' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Themes', options: uri: 'atom://config/themes' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/install').then (s) -> settingsView = s + waitsForPromise -> + atom.workspace.open('atom://config/updates').then (s) -> settingsView = s - hasSystemPanel = false - waits 1 - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Install', options: uri: 'atom://config/install' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - hasSystemPanel = settingsView.panelsByName['System']? + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Updates', options: uri: 'atom://config/updates' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() - if hasSystemPanel waitsForPromise -> - atom.workspace.open('atom://config/system').then (s) -> settingsView = s + atom.workspace.open('atom://config/install').then (s) -> settingsView = s + hasSystemPanel = false waits 1 runs -> expect(settingsView.activePanel) - .toEqual name: 'System', options: uri: 'atom://config/system' + .toEqual name: 'Install', options: uri: 'atom://config/install' expect(focusIsWithinActivePanel()).toBe true expectActivePanelToBeKeyboardScrollable() + hasSystemPanel = settingsView.panelsByName['System']? + + if hasSystemPanel + waitsForPromise -> + atom.workspace.open('atom://config/system').then (s) -> settingsView = s + + waits 1 + runs -> + expect(settingsView.activePanel) + .toEqual name: 'System', options: uri: 'atom://config/system' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() it "opens the package settings view with atom://config/packages/", -> waitsForPromise -> From e6ba7eccf768d018c0ee58d6dac5b841edcf6b35 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 18:33:22 -0500 Subject: [PATCH 02/11] Revert "Merge pull request #1035 from atom/revert-1027-wl-deactivate-disposables" This reverts commit 594c12fc31197a756c4f477d584e7313c5d46079, reversing changes made to 25127a9e3536adb02030e2cf5b27e24663bc6fc6. --- lib/main.js | 17 ++++++++++++----- lib/package-manager.coffee | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index e509f547..3d8c40f7 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,6 +3,8 @@ let settingsView = null let statusView = null +const {CompositeDisposable} = require('atom') + const PackageManager = require('./package-manager') let packageManager = null @@ -42,7 +44,9 @@ module.exports = { }, activate() { - atom.workspace.addOpener(uri => { + this.disposables = new CompositeDisposable() + + this.disposables.add(atom.workspace.addOpener(uri => { if (uri.startsWith(CONFIG_URI)) { if (settingsView == null || settingsView.destroyed) { settingsView = this.createSettingsView({uri}) @@ -56,9 +60,9 @@ module.exports = { } return settingsView } - }) + })) - atom.commands.add('atom-workspace', { + this.disposables.add(atom.commands.add('atom-workspace', { 'settings-view:open'() { atom.workspace.open(CONFIG_URI) }, 'settings-view:core'() { atom.workspace.open(`${CONFIG_URI}/core`) }, 'settings-view:editor'() { atom.workspace.open(`${CONFIG_URI}/editor`) }, @@ -70,10 +74,10 @@ module.exports = { 'settings-view:view-installed-packages'() { atom.workspace.open(`${CONFIG_URI}/packages`) }, 'settings-view:uninstall-packages'() { atom.workspace.open(`${CONFIG_URI}/packages`) }, 'settings-view:check-for-package-updates'() { atom.workspace.open(`${CONFIG_URI}/updates`) } - }) + })) if (process.platform === 'win32' && require('atom').WinShell != null) { - atom.commands.add('atom-workspace', {'settings-view:system'() { atom.workspace.open(`${CONFIG_URI}/system`) }}) + this.disposables.add(atom.commands.add('atom-workspace', {'settings-view:system'() { atom.workspace.open(`${CONFIG_URI}/system`) }})) } if (!localStorage.getItem('hasSeenDeprecatedNotification')) { @@ -85,8 +89,11 @@ module.exports = { }, deactivate() { + if (this.disposables) this.disposables.dispose() if (settingsView) settingsView.destroy() + if (packageManager) packageManager.destroy() if (statusView) statusView.destroy() + this.disposables = null settingsView = null packageManager = null statusView = null diff --git a/lib/package-manager.coffee b/lib/package-manager.coffee index 1a717bbf..d33a9cb7 100644 --- a/lib/package-manager.coffee +++ b/lib/package-manager.coffee @@ -18,6 +18,9 @@ class PackageManager @emitter = new Emitter + destroy: -> + @emitter.dispose() + getClient: -> @client ?= new Client(this) From c7f2279cd8dfc6007d3b0cabc72aac8b628c3c6c Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 20:57:28 -0500 Subject: [PATCH 03/11] What if we get rid of the waits? --- spec/settings-view-spec.coffee | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index 4a9e5c48..82fc8caf 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -199,13 +199,11 @@ describe "SettingsView", -> expect(atom.workspace.getActivePaneItem().activePanel) .toEqual name: 'Updates', options: uri: 'atom://config/updates' - for i in [1..100] + for i in [1..5] describe "when atom.workspace.open() is used with a config URI #{i}", -> focusIsWithinActivePanel = -> activePanel = settingsView.panelsByName[settingsView.activePanel.name] - if activePanel.element isnt document.activeElement and not activePanel.element.contains(document.activeElement) - console.log document.activeElement - activePanel.element is document.activeElement or activePanel.element.contains(document.activeElement) + activePanel.element.contains(document.activeElement) expectActivePanelToBeKeyboardScrollable = -> activePanel = settingsView.panelsByName[settingsView.activePanel.name] @@ -223,7 +221,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config').then (s) -> settingsView = s - waitsFor (done) -> process.nextTick(done) + # waitsFor (done) -> process.nextTick(done) runs -> expect(settingsView.activePanel) .toEqual name: 'Core', options: {} @@ -233,7 +231,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/editor').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Editor', options: uri: 'atom://config/editor' @@ -243,7 +241,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' @@ -253,7 +251,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/packages').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Packages', options: uri: 'atom://config/packages' @@ -263,7 +261,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/themes').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Themes', options: uri: 'atom://config/themes' @@ -273,7 +271,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/updates').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Updates', options: uri: 'atom://config/updates' @@ -284,7 +282,7 @@ describe "SettingsView", -> atom.workspace.open('atom://config/install').then (s) -> settingsView = s hasSystemPanel = false - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Install', options: uri: 'atom://config/install' @@ -296,7 +294,7 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/system').then (s) -> settingsView = s - waits 1 + # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'System', options: uri: 'atom://config/system' From 423f3292a67c2753c12475f55f2aea384ef76d11 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 21:14:45 -0500 Subject: [PATCH 04/11] Slowly rollback changes --- lib/main.js | 2 +- spec/settings-view-spec.coffee | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/main.js b/lib/main.js index 3d8c40f7..f2721c18 100644 --- a/lib/main.js +++ b/lib/main.js @@ -91,7 +91,7 @@ module.exports = { deactivate() { if (this.disposables) this.disposables.dispose() if (settingsView) settingsView.destroy() - if (packageManager) packageManager.destroy() + // if (packageManager) packageManager.destroy() if (statusView) statusView.destroy() this.disposables = null settingsView = null diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index 82fc8caf..fc55fbfc 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -221,7 +221,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config').then (s) -> settingsView = s - # waitsFor (done) -> process.nextTick(done) runs -> expect(settingsView.activePanel) .toEqual name: 'Core', options: {} @@ -231,7 +230,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/editor').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Editor', options: uri: 'atom://config/editor' @@ -241,7 +239,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' @@ -251,7 +248,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/packages').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Packages', options: uri: 'atom://config/packages' @@ -261,7 +257,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/themes').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Themes', options: uri: 'atom://config/themes' @@ -271,7 +266,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/updates').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Updates', options: uri: 'atom://config/updates' @@ -282,7 +276,6 @@ describe "SettingsView", -> atom.workspace.open('atom://config/install').then (s) -> settingsView = s hasSystemPanel = false - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'Install', options: uri: 'atom://config/install' @@ -294,7 +287,6 @@ describe "SettingsView", -> waitsForPromise -> atom.workspace.open('atom://config/system').then (s) -> settingsView = s - # waits 1 runs -> expect(settingsView.activePanel) .toEqual name: 'System', options: uri: 'atom://config/system' From d040639aacce5200dd6f307c7b9f9af435566722 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 21:30:19 -0500 Subject: [PATCH 05/11] Don't test anything that might touch PackageManager --- lib/main.js | 2 +- spec/settings-view-spec.coffee | 94 +++++++++++++++++----------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/main.js b/lib/main.js index f2721c18..3d8c40f7 100644 --- a/lib/main.js +++ b/lib/main.js @@ -91,7 +91,7 @@ module.exports = { deactivate() { if (this.disposables) this.disposables.dispose() if (settingsView) settingsView.destroy() - // if (packageManager) packageManager.destroy() + if (packageManager) packageManager.destroy() if (statusView) statusView.destroy() this.disposables = null settingsView = null diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index fc55fbfc..5ea8df31 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -245,53 +245,53 @@ describe "SettingsView", -> expect(focusIsWithinActivePanel()).toBe true expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/packages').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Packages', options: uri: 'atom://config/packages' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - - waitsForPromise -> - atom.workspace.open('atom://config/themes').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Themes', options: uri: 'atom://config/themes' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - - waitsForPromise -> - atom.workspace.open('atom://config/updates').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Updates', options: uri: 'atom://config/updates' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - - waitsForPromise -> - atom.workspace.open('atom://config/install').then (s) -> settingsView = s - - hasSystemPanel = false - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Install', options: uri: 'atom://config/install' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() - hasSystemPanel = settingsView.panelsByName['System']? - - if hasSystemPanel - waitsForPromise -> - atom.workspace.open('atom://config/system').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'System', options: uri: 'atom://config/system' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + # waitsForPromise -> + # atom.workspace.open('atom://config/packages').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Packages', options: uri: 'atom://config/packages' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() + + # waitsForPromise -> + # atom.workspace.open('atom://config/themes').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Themes', options: uri: 'atom://config/themes' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() + # + # waitsForPromise -> + # atom.workspace.open('atom://config/updates').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Updates', options: uri: 'atom://config/updates' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() + # + # waitsForPromise -> + # atom.workspace.open('atom://config/install').then (s) -> settingsView = s + # + # hasSystemPanel = false + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Install', options: uri: 'atom://config/install' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() + # hasSystemPanel = settingsView.panelsByName['System']? + # + # if hasSystemPanel + # waitsForPromise -> + # atom.workspace.open('atom://config/system').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'System', options: uri: 'atom://config/system' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() it "opens the package settings view with atom://config/packages/", -> waitsForPromise -> From 5c6a4f63af779a6b81b8e2dfc937babef3bed554 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 21:38:24 -0500 Subject: [PATCH 06/11] And if we only try Editor? --- spec/settings-view-spec.coffee | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index 5ea8df31..eb3303f0 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -218,14 +218,14 @@ describe "SettingsView", -> settingsView = null it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> - waitsForPromise -> - atom.workspace.open('atom://config').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Core', options: {} - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + # waitsForPromise -> + # atom.workspace.open('atom://config').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Core', options: {} + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() waitsForPromise -> atom.workspace.open('atom://config/editor').then (s) -> settingsView = s @@ -236,14 +236,14 @@ describe "SettingsView", -> expect(focusIsWithinActivePanel()).toBe true expectActivePanelToBeKeyboardScrollable() - waitsForPromise -> - atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s - - runs -> - expect(settingsView.activePanel) - .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' - expect(focusIsWithinActivePanel()).toBe true - expectActivePanelToBeKeyboardScrollable() + # waitsForPromise -> + # atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s + # + # runs -> + # expect(settingsView.activePanel) + # .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' + # expect(focusIsWithinActivePanel()).toBe true + # expectActivePanelToBeKeyboardScrollable() # waitsForPromise -> # atom.workspace.open('atom://config/packages').then (s) -> settingsView = s From b0bc7c60fa193849532dabba3e800eb7a225cd21 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 21:47:19 -0500 Subject: [PATCH 07/11] Check packageManager's destroy calls --- spec/settings-view-spec.coffee | 133 +++++++++++++++++---------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index eb3303f0..650aad9a 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -218,14 +218,16 @@ describe "SettingsView", -> settingsView = null it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> - # waitsForPromise -> - # atom.workspace.open('atom://config').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Core', options: {} - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() + spyOn(packageManager, 'destroy').andCallThrough() + + waitsForPromise -> + atom.workspace.open('atom://config').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Core', options: {} + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() waitsForPromise -> atom.workspace.open('atom://config/editor').then (s) -> settingsView = s @@ -236,62 +238,65 @@ describe "SettingsView", -> expect(focusIsWithinActivePanel()).toBe true expectActivePanelToBeKeyboardScrollable() - # waitsForPromise -> - # atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() - - # waitsForPromise -> - # atom.workspace.open('atom://config/packages').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Packages', options: uri: 'atom://config/packages' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() - - # waitsForPromise -> - # atom.workspace.open('atom://config/themes').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Themes', options: uri: 'atom://config/themes' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() - # - # waitsForPromise -> - # atom.workspace.open('atom://config/updates').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Updates', options: uri: 'atom://config/updates' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() - # - # waitsForPromise -> - # atom.workspace.open('atom://config/install').then (s) -> settingsView = s - # - # hasSystemPanel = false - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'Install', options: uri: 'atom://config/install' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() - # hasSystemPanel = settingsView.panelsByName['System']? - # - # if hasSystemPanel - # waitsForPromise -> - # atom.workspace.open('atom://config/system').then (s) -> settingsView = s - # - # runs -> - # expect(settingsView.activePanel) - # .toEqual name: 'System', options: uri: 'atom://config/system' - # expect(focusIsWithinActivePanel()).toBe true - # expectActivePanelToBeKeyboardScrollable() + waitsForPromise -> + atom.workspace.open('atom://config/keybindings').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Keybindings', options: uri: 'atom://config/keybindings' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + + waitsForPromise -> + atom.workspace.open('atom://config/packages').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Packages', options: uri: 'atom://config/packages' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + + waitsForPromise -> + atom.workspace.open('atom://config/themes').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Themes', options: uri: 'atom://config/themes' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + + waitsForPromise -> + atom.workspace.open('atom://config/updates').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Updates', options: uri: 'atom://config/updates' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + + waitsForPromise -> + atom.workspace.open('atom://config/install').then (s) -> settingsView = s + + hasSystemPanel = false + runs -> + expect(settingsView.activePanel) + .toEqual name: 'Install', options: uri: 'atom://config/install' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + hasSystemPanel = settingsView.panelsByName['System']? + + if hasSystemPanel + waitsForPromise -> + atom.workspace.open('atom://config/system').then (s) -> settingsView = s + + runs -> + expect(settingsView.activePanel) + .toEqual name: 'System', options: uri: 'atom://config/system' + expect(focusIsWithinActivePanel()).toBe true + expectActivePanelToBeKeyboardScrollable() + + runs -> + expect(packageManager.destroy).not.toHaveBeenCalled() it "opens the package settings view with atom://config/packages/", -> waitsForPromise -> From 306a6004c9c125f25ec094e7857dc1be675600ef Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 22:18:02 -0500 Subject: [PATCH 08/11] We need the prototype --- spec/settings-view-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index 650aad9a..d0a2fc65 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -218,7 +218,7 @@ describe "SettingsView", -> settingsView = null it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> - spyOn(packageManager, 'destroy').andCallThrough() + spyOn(PackageManager.prototype, 'destroy').andCallThrough() waitsForPromise -> atom.workspace.open('atom://config').then (s) -> settingsView = s @@ -296,7 +296,7 @@ describe "SettingsView", -> expectActivePanelToBeKeyboardScrollable() runs -> - expect(packageManager.destroy).not.toHaveBeenCalled() + expect(PackageManager.prototype.destroy).not.toHaveBeenCalled() it "opens the package settings view with atom://config/packages/", -> waitsForPromise -> From ec1aadfcaa9328922c049c849bec8cd8b69447cf Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 22:27:35 -0500 Subject: [PATCH 09/11] Try using Trusty on Travis for faster feedback --- .travis.yml | 36 +++++++++++++++++++++++++++++----- spec/settings-view-spec.coffee | 5 ----- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20cfe517..47ee9a1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,41 @@ -language: objective-c +### Project specific config ### +language: generic + +env: + global: + - APM_TEST_PACKAGES="" + - ATOM_LINT_WITH_BUNDLED_NODE="true" + + matrix: + - ATOM_CHANNEL=stable + - ATOM_CHANNEL=beta + +### Generic setup follows ### +script: + - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh + - chmod u+x build-package.sh + - ./build-package.sh notifications: email: on_success: never on_failure: change -script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh' +branches: + only: + - master git: depth: 10 -branches: - only: - - master +sudo: false + +dist: trusty + +addons: + apt: + packages: + - build-essential + - fakeroot + - git + - libsecret-1-dev diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index d0a2fc65..fc55fbfc 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -218,8 +218,6 @@ describe "SettingsView", -> settingsView = null it "opens the settings to the correct panel with atom://config/ and that panel is keyboard-scrollable", -> - spyOn(PackageManager.prototype, 'destroy').andCallThrough() - waitsForPromise -> atom.workspace.open('atom://config').then (s) -> settingsView = s @@ -295,9 +293,6 @@ describe "SettingsView", -> expect(focusIsWithinActivePanel()).toBe true expectActivePanelToBeKeyboardScrollable() - runs -> - expect(PackageManager.prototype.destroy).not.toHaveBeenCalled() - it "opens the package settings view with atom://config/packages/", -> waitsForPromise -> atom.packages.activatePackage(path.join(__dirname, 'fixtures', 'package-with-readme')) From 3dcd92211d59d8271e396a1cae53878e2497a524 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 22:35:11 -0500 Subject: [PATCH 10/11] Travis please --- spec/settings-view-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/settings-view-spec.coffee b/spec/settings-view-spec.coffee index fc55fbfc..e71e9bcb 100644 --- a/spec/settings-view-spec.coffee +++ b/spec/settings-view-spec.coffee @@ -203,6 +203,7 @@ describe "SettingsView", -> describe "when atom.workspace.open() is used with a config URI #{i}", -> focusIsWithinActivePanel = -> activePanel = settingsView.panelsByName[settingsView.activePanel.name] + process.stdout.write(document.activeElement.outerHTML) activePanel.element.contains(document.activeElement) expectActivePanelToBeKeyboardScrollable = -> From a46594b7fc39b4b1e8c90e61c5679cb053d2ee67 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 3 Jan 2018 22:38:39 -0500 Subject: [PATCH 11/11] Of course it's a macOS-only issue. --- .travis.yml | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47ee9a1a..20cfe517 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,15 @@ -### Project specific config ### -language: generic - -env: - global: - - APM_TEST_PACKAGES="" - - ATOM_LINT_WITH_BUNDLED_NODE="true" - - matrix: - - ATOM_CHANNEL=stable - - ATOM_CHANNEL=beta - -### Generic setup follows ### -script: - - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh - - chmod u+x build-package.sh - - ./build-package.sh +language: objective-c notifications: email: on_success: never on_failure: change -branches: - only: - - master +script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh' git: depth: 10 -sudo: false - -dist: trusty - -addons: - apt: - packages: - - build-essential - - fakeroot - - git - - libsecret-1-dev +branches: + only: + - master