Browse Source

chore: revert key -> main change in window delegate listener (#19239)

Erick Zhao 5 years ago
parent
commit
489e40f763
2 changed files with 2 additions and 29 deletions
  1. 2 2
      atom/browser/ui/cocoa/atom_ns_window_delegate.mm
  2. 0 27
      spec/api-browser-window-spec.js

+ 2 - 2
atom/browser/ui/cocoa/atom_ns_window_delegate.mm

@@ -83,11 +83,11 @@
   return frame;
 }
 
-- (void)windowDidBecomeKey:(NSNotification*)notification {
+- (void)windowDidBecomeMain:(NSNotification*)notification {
   shell_->NotifyWindowFocus();
 }
 
-- (void)windowDidResignKey:(NSNotification*)notification {
+- (void)windowDidResignMain:(NSNotification*)notification {
   shell_->NotifyWindowBlur();
 }
 

+ 0 - 27
spec/api-browser-window-spec.js

@@ -2330,33 +2330,6 @@ describe('BrowserWindow module', () => {
     })
   })
 
-  describe('focus event', () => {
-    it('should not emit if focusing on a main window with a modal open', (done) => {
-      const child = new BrowserWindow({
-        parent: w,
-        modal: true,
-        show: false
-      })
-
-      child.once('ready-to-show', () => {
-        child.show()
-      })
-
-      child.on('show', () => {
-        w.once('focus', () => {
-          expect(child.isDestroyed()).to.equal(true)
-          done()
-        })
-        w.focus() // this should not trigger the above listener
-        child.close()
-      })
-
-      // act
-      child.loadURL(server.url)
-      w.show()
-    })
-  })
-
   describe('sheet-begin event', () => {
     let sheet = null