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

This commit is contained in:
Jeremy Apthorp 2019-07-24 17:18:11 -07:00 коммит произвёл GitHub
Родитель 95977291f7
Коммит 86c2ea1cb8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 48 добавлений и 11 удалений

Просмотреть файл

@ -110,6 +110,44 @@ shown notification and create a new one with identical properties.
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
On macOS, you can specify the name of the sound you'd like to play when the

Просмотреть файл

@ -1,10 +1,5 @@
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const { expect } = chai
chai.use(dirtyChai)
const { Notification } = require('electron').remote
import { expect } from 'chai'
import { Notification } from 'electron'
describe('Notification module', () => {
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', () => {
const n = new Notification({
title: 'title',
body: 'body',
silent: true,
hasReply: true
})
expect(n.silent).to.be.true()
expect(n.silent).to.be.true('silent')
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
expect(n.hasReply).to.be.false()
expect(n.hasReply).to.be.false('has reply')
})
it('inits, gets and sets actions correctly', () => {
const n = new Notification({
title: 'title',
body: 'body',
actions: [
{
type: 'button',