blob: c0ebe7e6998e96673599600367424f8aa3e8c652 [file] [log] [blame]
Michael[tm] Smithce5df022015-02-16 15:00:001<!DOCTYPE html>
2<meta charset="utf-8">
Michael[tm] Smith29e47812015-07-03 13:39:013<title>Notification instance basic tests</title>
Michael[tm] Smithce5df022015-02-16 15:00:004<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6<script>
Michael[tm] Smith29e47812015-07-03 13:39:017if (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] Smithce5df022015-02-16 15:00:0025 }
Michael[tm] Smith29e47812015-07-03 13:39:0126 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] Smithce5df022015-02-16 15:00:0063</script>