Skip to content

Commit ed3b69f

Browse files
authored
docs: update hasShadow for win and linux (electron#19675)
1 parent 0fb3c8c commit ed3b69f

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

docs/api/browser-window.md

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

1440-
#### `win.setHasShadow(hasShadow)` _macOS_
1440+
#### `win.setHasShadow(hasShadow)`
14411441

14421442
* `hasShadow` Boolean
14431443

1444-
Sets whether the window should have a shadow. On Windows and Linux does
1445-
nothing.
1444+
Sets whether the window should have a shadow.
14461445

1447-
#### `win.hasShadow()` _macOS_
1446+
#### `win.hasShadow()`
14481447

14491448
Returns `Boolean` - Whether the window has a shadow.
14501449

1451-
On Windows and Linux always returns
1452-
`true`.
1453-
14541450
#### `win.setOpacity(opacity)` _Windows_ _macOS_
14551451

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

spec-main/api-browser-window-spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,21 +3338,27 @@ describe('BrowserWindow module', () => {
33383338
})
33393339

33403340
describe('hasShadow state', () => {
3341-
// On Windows there is no shadow by default and it can not be changed
3342-
// dynamically.
3341+
it('returns a boolean on all platforms', () => {
3342+
const w = new BrowserWindow({ show: false })
3343+
const hasShadow = w.hasShadow()
3344+
expect(hasShadow).to.be.a('boolean')
3345+
})
3346+
3347+
// On Windows there's no shadow by default & it can't be changed dynamically.
33433348
it('can be changed with hasShadow option', () => {
33443349
const hasShadow = process.platform !== 'darwin'
3345-
const w = new BrowserWindow({ show: false, hasShadow: hasShadow })
3350+
const w = new BrowserWindow({ show: false, hasShadow })
33463351
expect(w.hasShadow()).to.equal(hasShadow)
33473352
})
33483353

3349-
ifit(process.platform === 'darwin')('can be changed with setHasShadow method', () => {
3354+
it('can be changed with setHasShadow method', () => {
33503355
const w = new BrowserWindow({ show: false })
3351-
expect(w.hasShadow()).to.be.true('hasShadow')
33523356
w.setHasShadow(false)
33533357
expect(w.hasShadow()).to.be.false('hasShadow')
33543358
w.setHasShadow(true)
33553359
expect(w.hasShadow()).to.be.true('hasShadow')
3360+
w.setHasShadow(false)
3361+
expect(w.hasShadow()).to.be.false('hasShadow')
33563362
})
33573363
})
33583364
})

0 commit comments

Comments
 (0)