From 1ae8862a9c50d6eeaf4de58dd9fe155ff8ad2422 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 24 Nov 2014 14:43:12 -0800 Subject: [PATCH] Notification::getTimestamp() --- spec/notification-manager-spec.coffee | 2 +- spec/notification-spec.coffee | 7 ++++++- src/notification.coffee | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/notification-manager-spec.coffee b/spec/notification-manager-spec.coffee index f9cd5fcf9..dfc16322c 100644 --- a/spec/notification-manager-spec.coffee +++ b/spec/notification-manager-spec.coffee @@ -1,6 +1,6 @@ NotificationManager = require '../src/notification-manager' -fdescribe "NotificationManager", -> +describe "NotificationManager", -> [manager] = [] beforeEach -> diff --git a/spec/notification-spec.coffee b/spec/notification-spec.coffee index b0c201452..c564edc89 100644 --- a/spec/notification-spec.coffee +++ b/spec/notification-spec.coffee @@ -1,8 +1,13 @@ Notification = require '../src/notification' -fdescribe "Notification", -> +describe "Notification", -> [notification] = [] + describe "::getTimestamp()", -> + it "returns a Date object", -> + notification = new Notification('error', 'message!') + expect(notification.getTimestamp() instanceof Date).toBe true + describe "::getIcon()", -> it "returns a default when no icon specified", -> notification = new Notification('error', 'message!') diff --git a/src/notification.coffee b/src/notification.coffee index e4b5fec54..04de5db18 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -3,6 +3,7 @@ module.exports = class Notification constructor: (@type, @message, @options={}) -> + @timestamp = new Date() getOptions: -> @options @@ -10,6 +11,8 @@ class Notification getMessage: -> @message + getTimestamp: -> @timestamp + getDetail: -> @optons.detail isClosable: ->