Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/latest/.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
774d5d0a051374923758372a4ee4bf04f473151d
60169b45c12488c6fda237af7f6425526a7ce5f0
4 changes: 2 additions & 2 deletions docs/latest/api/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Notification.removeGroup('chat-thread-1')
* `replyPlaceholder` string (optional) _macOS_ _Windows_ - The placeholder to write in the inline reply input field.
* `sound` string (optional) _macOS_ - The name of the sound file to play when the notification is shown.
* `urgency` string (optional) _Linux_ _Windows_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ _Windows_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
* `closeButtonText` string (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
* `toastXml` string (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.

Expand Down Expand Up @@ -303,7 +303,7 @@ app.whenReady().then(() => {
})
```

#### Event: 'action' _macOS_ _Windows_
#### Event: 'action'

Returns:

Expand Down
11 changes: 10 additions & 1 deletion docs/latest/api/structures/notification-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ hide_title: false

| Action Type | Platform Support | Usage of `text` | Default `text` | Limitations |
|-------------|------------------|-----------------|----------------|-------------|
| `button` | macOS, Windows | Used as the label for the button | "Show" on macOS (localized) if first `button`, otherwise empty; Windows uses provided `text` | macOS: Only the first one is used as primary; others shown as additional actions (hover). Incompatible with `hasReply` (beyond first ignored). |
| `button` | macOS, Windows, Linux | Used as the label for the button | "Show" on macOS (localized) if first `button`, otherwise empty; Windows uses provided `text`; Linux does not show a button without `text` | macOS: Only the first one is used as primary; others shown as additional actions (hover). Incompatible with `hasReply` (beyond first ignored). Linux: Requires a notification server with the `actions` capability. |
| `selection` | Windows | Used as the label for the submit button for the selection menu | "Select" | Requires an `items` array property specifying option labels. Emits the `action` event with `(index, selectedIndex)` where `selectedIndex` is the chosen option (>= 0). Ignored on platforms that do not support selection actions. |

### Button support on macOS
Expand All @@ -28,6 +28,15 @@ following criteria.

If either of these requirements are not met the button won't appear.

### Button support on Linux

Buttons are shown only if the desktop's notification server advertises the
`actions` [capability](https://specifications.freedesktop.org/notification/latest/protocol.html#command-get-capabilities).
Otherwise the notification is shown without them.

In a Flatpak or Snap sandbox, a notification that has buttons also shows its
default action as a "Show" button, which emits `click`.

### Selection support on Windows

To add a selection (combo box) style action, include an action with `type: 'selection'`, a `text` label for the submit button, and an `items` array of strings:
Expand Down
9 changes: 6 additions & 3 deletions docs/latest/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ name matches a pattern, run `npm run test -- -g=PATTERN`, replacing
`PATTERN` with a regex. As an example: If you want to run only IPC tests, you
would run `npm run test -- -g ipc`.

The spec files use mocha's interface (`describe`, `it`, `before`, `after`,
`this.timeout()`), provided on top of vitest by `spec/vitest/mocha-compat.ts`,
and [chai](https://www.chaijs.com) assertions.
Specs import `describe`, `it`, `expect` and the hooks from `vitest` and assert
with its matchers (`expect(x).toBe(y)`, `toEqual`, `toHaveProperty`, ...);
chai-style chains (`expect(x).to.equal(y)`) are rejected by the linter because
their property form can silently assert nothing. A few Electron specific
behaviours (a macrotask between tests, `defer()` cleanup,
`spec/disabled-tests.json`) live in `spec/vitest/runner.ts`.

## Node.js Smoke Tests

Expand Down
Loading