From 86c2ea1cb836d8a12655eede0fc639c89d879656 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 24 Jul 2019 17:18:11 -0700 Subject: [PATCH] test: move Notification spec to main process (#19414) --- docs/api/notification.md | 38 +++++++++++++++++++ .../api-notification-spec.ts | 21 +++++----- 2 files changed, 48 insertions(+), 11 deletions(-) rename spec/api-notification-spec.js => spec-main/api-notification-spec.ts (86%) diff --git a/docs/api/notification.md b/docs/api/notification.md index b57188071395..61a0c3aabf23 100644 --- a/docs/api/notification.md +++ b/docs/api/notification.md @@ -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 diff --git a/spec/api-notification-spec.js b/spec-main/api-notification-spec.ts similarity index 86% rename from spec/api-notification-spec.js rename to spec-main/api-notification-spec.ts index 747040825c85..3e872f88235f 100644 --- a/spec/api-notification-spec.js +++ b/spec-main/api-notification-spec.ts @@ -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',