| Michael[tm] Smith | ce5df02 | 2015-02-16 15:00:00 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <meta charset="utf-8"> |
| Michael[tm] Smith | 29e4781 | 2015-07-03 13:39:01 | [diff] [blame] | 3 | <title>Notification instance basic tests</title> |
| Michael[tm] Smith | ce5df02 | 2015-02-16 15:00:00 | [diff] [blame] | 4 | <script src="/resources/testharness.js"></script> |
| 5 | <script src="/resources/testharnessreport.js"></script> |
| 6 | <script> |
| Michael[tm] Smith | 29e4781 | 2015-07-03 13:39:01 | [diff] [blame] | 7 | if (Notification.permission != "granted") { |
| 8 | test(function() { |
| 9 | this.force_timeout() |
| 10 | this.set_status(this.NOTRUN, "You must allow notifications for this" |
| 11 | + " origin before running this test.") |
| 12 | }) |
| 13 | } else { |
| 14 | var n = new Notification("Radio check", |
| 15 | { |
| 16 | dir: "ltr", |
| 17 | lang: "aa", |
| 18 | body: "This is a radio check.", |
| 19 | tag: "radio_check999", |
| 20 | icon: "http://example.com/icon.png", |
| 21 | } |
| 22 | ) |
| 23 | n.onshow = function() { |
| 24 | n.close() |
| Michael[tm] Smith | ce5df02 | 2015-02-16 15:00:00 | [diff] [blame] | 25 | } |
| Michael[tm] Smith | 29e4781 | 2015-07-03 13:39:01 | [diff] [blame] | 26 | test(function() { |
| 27 | assert_true(n instanceof Notification) |
| 28 | },"Notification instance exists.") |
| 29 | test(function() { |
| 30 | assert_true("close" in n) |
| 31 | },"Attribute exists: close") |
| 32 | test(function() { |
| 33 | assert_true("onclick" in n) |
| 34 | },"Attribute exists: onclick") |
| 35 | test(function() { |
| 36 | assert_true("onshow" in n) |
| 37 | },"Attribute exists: onshow") |
| 38 | test(function() { |
| 39 | assert_true("onerror" in n) |
| 40 | },"Attribute exists: onerror") |
| 41 | test(function() { |
| 42 | assert_true("onclose" in n) |
| 43 | },"Attribute exists: onclose") |
| 44 | test(function() { |
| 45 | assert_equals("Radio check", n.title) |
| 46 | },"Attribute exists with expected value: title") |
| 47 | test(function() { |
| 48 | assert_equals("ltr", n.dir) |
| 49 | },"Attribute exists with expected value: dir") |
| 50 | test(function() { |
| 51 | assert_equals("aa", n.lang) |
| 52 | },"Attribute exists with expected value: lang") |
| 53 | test(function() { |
| 54 | assert_equals("This is a radio check.", n.body) |
| 55 | },"Attribute exists with expected value: body") |
| 56 | test(function() { |
| 57 | assert_equals("radio_check999", n.tag) |
| 58 | },"Attribute exists with expected value: tag") |
| 59 | test(function() { |
| 60 | assert_equals("http://example.com/icon.png", n.icon) |
| 61 | },"Attribute exists with expected value: icon") |
| 62 | } |
| Michael[tm] Smith | ce5df02 | 2015-02-16 15:00:00 | [diff] [blame] | 63 | </script> |