Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit c0df23e

Browse files
committed
clear non-dismissable notifications
1 parent 2428308 commit c0df23e

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

lib/main.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ Notifications =
6464
@subscriptions.add atom.workspace.addOpener (uri) => @createLog() if uri is NotificationsLog::getURI()
6565
@subscriptions.add atom.commands.add 'atom-workspace', 'notifications:toggle-log', -> atom.workspace.toggle(NotificationsLog::getURI())
6666
@subscriptions.add atom.commands.add 'atom-workspace', 'notifications-plus:clear-log', =>
67-
notification.dismiss() for notification in atom.notifications.getNotifications()
67+
for notification in atom.notifications.getNotifications()
68+
notification.options.dismissable = true
69+
notification.dismissed = false
70+
notification.dismiss()
6871
atom.notifications.clear()
6972
@notificationsLog?.clearLogItems() # TODO: remove this once atom/atom#16074 is released
7073

spec/notifications-log-spec.coffee

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,24 +238,16 @@ describe "Notifications Log", ->
238238
beforeEach ->
239239
clearButton = workspaceElement.querySelector('.notifications-log .notifications-clear-log')
240240
atom.notifications.addInfo('A message', dismissable: true)
241+
atom.notifications.addInfo('non-dismissable')
241242
clearButton.click()
242243

243244
it "clears the notifications", ->
244245
expect(atom.notifications.getNotifications()).toHaveLength 0
245246
notifications = workspaceElement.querySelector('atom-notifications')
246247
advanceClock(NotificationElement::animationDuration)
247-
expect(notifications.childNodes).toHaveLength 0
248+
expect(notifications.children).toHaveLength 0
248249
logItems = workspaceElement.querySelector('.notifications-log-items')
249-
expect(logItems.childNodes).toHaveLength 0
250-
251-
# TODO: These don't work most likely because of some async operation
252-
# it "removes all notifications", ->
253-
# notifications = workspaceElement.querySelector('atom-notifications')
254-
# expect(notifications.childNodes).toHaveLength 0
255-
#
256-
# it "clears the notifications log", ->
257-
# logItems = workspaceElement.querySelector('.notifications-log-items')
258-
# expect(logItems.childNodes).toHaveLength 0
250+
expect(logItems.children).toHaveLength 0
259251

260252
describe "the dock pane", ->
261253
notificationsLogPane = null

0 commit comments

Comments
 (0)