test: move Notification spec to main process (#19414)

This commit is contained in:
Jeremy Apthorp 2019-07-24 17:18:11 -07:00 committed by GitHub
parent 95977291f7
commit 86c2ea1cb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 11 deletions

View file

@ -110,6 +110,44 @@ shown notification and create a new one with identical properties.
Dismisses the notification. Dismisses the notification.
### Instance Properties
#### `notification.title`
A `String` property representing the title of the notification.
#### `notification.subtitle`
A `String` property representing the subtitle of the notification.
#### `notification.body`
A `String` property representing the body of the notification.
#### `notification.replyPlaceholder`
A `String` property representing the reply placeholder of the notification.
#### `notification.sound`
A `String` property representing the sound of the notification.
#### `notification.closeButtonText`
A `String` property representing the close button text of the notification.
#### `notification.silent`
A `Boolean` property representing whether the notification is silent.
#### `notification.hasReply`
A `Boolean` property representing whether the notification has a reply action.
#### `notification.actions`
A [`NotificationAction[]`](structures/notification-action.md) property representing the actions of the notification.
### Playing Sounds ### Playing Sounds
On macOS, you can specify the name of the sound you'd like to play when the On macOS, you can specify the name of the sound you'd like to play when the

View file

@ -1,10 +1,5 @@
const chai = require('chai') import { expect } from 'chai'
const dirtyChai = require('dirty-chai') import { Notification } from 'electron'
const { expect } = chai
chai.use(dirtyChai)
const { Notification } = require('electron').remote
describe('Notification module', () => { describe('Notification module', () => {
it('inits, gets and sets basic string properties correctly', () => { it('inits, gets and sets basic string properties correctly', () => {
@ -44,21 +39,25 @@ describe('Notification module', () => {
it('inits, gets and sets basic boolean properties correctly', () => { it('inits, gets and sets basic boolean properties correctly', () => {
const n = new Notification({ const n = new Notification({
title: 'title',
body: 'body',
silent: true, silent: true,
hasReply: true hasReply: true
}) })
expect(n.silent).to.be.true() expect(n.silent).to.be.true('silent')
n.silent = false n.silent = false
expect(n.silent).to.be.false() expect(n.silent).to.be.false('silent')
expect(n.hasReply).to.be.true() expect(n.hasReply).to.be.true('has reply')
n.hasReply = false n.hasReply = false
expect(n.hasReply).to.be.false() expect(n.hasReply).to.be.false('has reply')
}) })
it('inits, gets and sets actions correctly', () => { it('inits, gets and sets actions correctly', () => {
const n = new Notification({ const n = new Notification({
title: 'title',
body: 'body',
actions: [ actions: [
{ {
type: 'button', type: 'button',