Permalink
Browse files

Merge branch 'release/0.2'

  • Loading branch information...
2 parents a15c800 + 290cb36 commit 46ecddb3e28e0730e8a5b47dd9567ef1b030b16d @demiazz committed Jan 28, 2012
Showing with 53 additions and 19 deletions.
  1. +24 −0 README.md
  2. +14 −9 jasmine-wkreporter.js
  3. +1 −1 jasmine-wkreporter.min.js
  4. +14 −9 lib/reporter.coffee
View
@@ -48,3 +48,27 @@ This is simple example of usage. :
When specs are running, will be used TrivialReporter (default for Jasmine), and
WebkitReporter.
+
+## Options
+
+WebKit Reporter have custom options:
+ * title - name of testing application;
+ * replaceId - custom replaceId for notifications (see Notifications API Draft);
+ * timeout - of timeout is greater such 0, then notifications will be autoclosed after timeout;
+ * passedIcon - icon for notifications about passed running;
+ * failedIcon - icon for notifications about failed running;
+ * runningIcon - icon for notifications about running.
+
+### Notes about icons
+
+Icons will be a URL or empty string for not showning icons.
+
+If you want enable icon, then recommend set as URL to icon.
+
+## Browsers without webkitNotifications
+
+If browser have not window.webkitNotifications, when reporter creating methods
+`reportRunnerStarting` and `reportRunnerResults` replaced by empty methods.
+
+This is make possible using library in non supported browsers without exceptions,
+and any actions for disabling of reporter.
View
@@ -91,16 +91,21 @@
function WebkitReporter(options) {
if (options == null) options = {};
- if (options) {
- if (options.title) this.title = options.title;
- if (options.replaceId) this.replaceId = options.replaceId;
- if (options.timeout) this.timeout = options.timeout;
- if (options.passedIcon) this.passedIcon = options.passedIcon;
- if (options.failedIcon) this.failedIcon = options.failedIcon;
- if (options.runningIcon) this.runningIcon = options.runningIcon;
+ if (jasmine.getGlobal().webkitNotifications) {
+ if (options) {
+ if (options.title) this.title = options.title;
+ if (options.replaceId) this.replaceId = options.replaceId;
+ if (options.timeout) this.timeout = options.timeout;
+ if (options.passedIcon) this.passedIcon = options.passedIcon;
+ if (options.failedIcon) this.failedIcon = options.failedIcon;
+ if (options.runningIcon) this.runningIcon = options.runningIcon;
+ }
+ this.startedAt = null;
+ this.finishedAt = null;
+ } else {
+ this.reportRunnerStarting = function() {};
+ this.reportRunnerResults = function() {};
}
- this.startedAt = null;
- this.finishedAt = null;
return;
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -75,15 +75,20 @@ class jasmine.WebkitReporter extends jasmine.Reporter
@param {Object|null} options - options for reporter
###
constructor: (options = {}) ->
- if options
- @title = options.title if options.title
- @replaceId = options.replaceId if options.replaceId
- @timeout = options.timeout if options.timeout
- @passedIcon = options.passedIcon if options.passedIcon
- @failedIcon = options.failedIcon if options.failedIcon
- @runningIcon = options.runningIcon if options.runningIcon
- @startedAt = null
- @finishedAt = null
+ if jasmine.getGlobal().webkitNotifications
+ if options
+ @title = options.title if options.title
+ @replaceId = options.replaceId if options.replaceId
+ @timeout = options.timeout if options.timeout
+ @passedIcon = options.passedIcon if options.passedIcon
+ @failedIcon = options.failedIcon if options.failedIcon
+ @runningIcon = options.runningIcon if options.runningIcon
+ @startedAt = null
+ @finishedAt = null
+ else
+ # safe stubing functions for reporting by empty methods
+ @reportRunnerStarting = () ->
+ @reportRunnerResults = () ->
return
###

0 comments on commit 46ecddb

Please sign in to comment.