return null when theme color is not found
This commit is contained in:
parent
4bc4a0c45b
commit
eeb2e58ad8
4 changed files with 29 additions and 2 deletions
|
@ -757,7 +757,11 @@ void WebContents::MediaStoppedPlaying(const MediaPlayerInfo& video_type,
|
|||
}
|
||||
|
||||
void WebContents::DidChangeThemeColor(SkColor theme_color) {
|
||||
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
|
||||
if (theme_color != SK_ColorTRANSPARENT) {
|
||||
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
|
||||
} else {
|
||||
Emit("did-change-theme-color", nullptr_t());
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::DocumentLoadedInFrame(
|
||||
|
|
|
@ -403,6 +403,12 @@ a meta tag:
|
|||
<meta name='theme-color' content='#ff0000'>
|
||||
```
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `color` string
|
||||
* Theme color in format '#rrggbb'. `null` when theme color is not found.
|
||||
|
||||
#### Event: 'update-target-url'
|
||||
|
||||
Returns:
|
||||
|
|
|
@ -654,4 +654,21 @@ describe('webContents module', function () {
|
|||
gen.next()
|
||||
})
|
||||
})
|
||||
|
||||
describe('did-change-theme-color event', () => {
|
||||
it('is triggered with correct theme color', (done) => {
|
||||
var count = 0
|
||||
w.webContents.on('did-change-theme-color', (e, color) => {
|
||||
if (count === 0) {
|
||||
count++
|
||||
assert.equal(color, '#FFEEDD')
|
||||
w.loadURL('file://' + path.join(__dirname, 'fixtures', 'pages', 'base-page.html'))
|
||||
} else if (count === 1) {
|
||||
assert.equal(color, null)
|
||||
done()
|
||||
}
|
||||
})
|
||||
w.loadURL('file://' + path.join(__dirname, 'fixtures', 'pages', 'theme-color.html'))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 7d9c1a80f025f4c46f7da8ea73246fe0f1968579
|
||||
Subproject commit f047bb61bbd985079dd93e7ed322999550efed1d
|
Loading…
Reference in a new issue