Skip to content

Commit 1103723

Browse files
trop[bot]codebytere
authored andcommitted
docs: update hasShadow for win and linux (electron#19675) (electron#19721)
1 parent bac9532 commit 1103723

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/api/browser-window.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,20 +1345,16 @@ screen readers
13451345
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
13461346
convey some sort of application status or to passively notify the user.
13471347

1348-
#### `win.setHasShadow(hasShadow)` _macOS_
1348+
#### `win.setHasShadow(hasShadow)`
13491349

13501350
* `hasShadow` Boolean
13511351

1352-
Sets whether the window should have a shadow. On Windows and Linux does
1353-
nothing.
1352+
Sets whether the window should have a shadow.
13541353

1355-
#### `win.hasShadow()` _macOS_
1354+
#### `win.hasShadow()`
13561355

13571356
Returns `Boolean` - Whether the window has a shadow.
13581357

1359-
On Windows and Linux always returns
1360-
`true`.
1361-
13621358
#### `win.setOpacity(opacity)` _Windows_ _macOS_
13631359

13641360
* `opacity` Number - between 0.0 (fully transparent) and 1.0 (fully opaque)

spec/api-browser-window-spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,23 +3015,29 @@ describe('BrowserWindow module', () => {
30153015
})
30163016

30173017
describe('hasShadow state', () => {
3018-
// On Window there is no shadow by default and it can not be changed
3019-
// dynamically.
3018+
beforeEach(() => { w.destroy() })
3019+
3020+
it('returns a boolean on all platforms', () => {
3021+
w = new BrowserWindow({ show: false })
3022+
const hasShadow = w.hasShadow()
3023+
assert.strictEqual(typeof hasShadow, 'boolean')
3024+
})
3025+
30203026
it('can be changed with hasShadow option', () => {
3021-
w.destroy()
30223027
const hasShadow = process.platform !== 'darwin'
3023-
w = new BrowserWindow({ show: false, hasShadow: hasShadow })
3028+
w = new BrowserWindow({ show: false, hasShadow })
30243029
assert.strictEqual(w.hasShadow(), hasShadow)
30253030
})
30263031

30273032
it('can be changed with setHasShadow method', () => {
3028-
if (process.platform !== 'darwin') return
3033+
w = new BrowserWindow({ show: false })
30293034

3030-
assert.strictEqual(w.hasShadow(), true)
30313035
w.setHasShadow(false)
30323036
assert.strictEqual(w.hasShadow(), false)
30333037
w.setHasShadow(true)
30343038
assert.strictEqual(w.hasShadow(), true)
3039+
w.setHasShadow(false)
3040+
assert.strictEqual(w.hasShadow(), false)
30353041
})
30363042
})
30373043
})

0 commit comments

Comments
 (0)