Browse Source

docs: update hasShadow for win and linux (#19675) (#19692)

Shelley Vohr 5 years ago
parent
commit
a8e70a8546
2 changed files with 15 additions and 13 deletions
  1. 3 7
      docs/api/browser-window.md
  2. 12 6
      spec/api-browser-window-spec.js

+ 3 - 7
docs/api/browser-window.md

@@ -1347,20 +1347,16 @@ screen readers
 Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
 convey some sort of application status or to passively notify the user.
 
-#### `win.setHasShadow(hasShadow)` _macOS_
+#### `win.setHasShadow(hasShadow)`
 
 * `hasShadow` Boolean
 
-Sets whether the window should have a shadow. On Windows and Linux does
-nothing.
+Sets whether the window should have a shadow.
 
-#### `win.hasShadow()` _macOS_
+#### `win.hasShadow()`
 
 Returns `Boolean` - Whether the window has a shadow.
 
-On Windows and Linux always returns
-`true`.
-
 #### `win.setOpacity(opacity)` _Windows_ _macOS_
 
 * `opacity` Number - between 0.0 (fully transparent) and 1.0 (fully opaque)

+ 12 - 6
spec/api-browser-window-spec.js

@@ -3094,23 +3094,29 @@ describe('BrowserWindow module', () => {
     })
 
     describe('hasShadow state', () => {
-      // On Window there is no shadow by default and it can not be changed
-      // dynamically.
+      beforeEach(() => { w.destroy() })
+
+      it('returns a boolean on all platforms', () => {
+        w = new BrowserWindow({ show: false })
+        const hasShadow = w.hasShadow()
+        assert.strictEqual(typeof hasShadow, 'boolean')
+      })
+
       it('can be changed with hasShadow option', () => {
-        w.destroy()
         const hasShadow = process.platform !== 'darwin'
-        w = new BrowserWindow({ show: false, hasShadow: hasShadow })
+        w = new BrowserWindow({ show: false, hasShadow })
         assert.strictEqual(w.hasShadow(), hasShadow)
       })
 
       it('can be changed with setHasShadow method', () => {
-        if (process.platform !== 'darwin') return
+        w = new BrowserWindow({ show: false })
 
-        assert.strictEqual(w.hasShadow(), true)
         w.setHasShadow(false)
         assert.strictEqual(w.hasShadow(), false)
         w.setHasShadow(true)
         assert.strictEqual(w.hasShadow(), true)
+        w.setHasShadow(false)
+        assert.strictEqual(w.hasShadow(), false)
       })
     })
   })