instance-checks.js (1987B)
1 const notification_args = [ 2 "Radio check", 3 { 4 dir: "ltr", 5 lang: "aa", 6 body: "This is a radio check.", 7 tag: "radio_check999", 8 icon: `${location.origin}/icon.png`, 9 requireInteraction: true, 10 silent: true, 11 data: fakeCustomData, 12 actions: [{ action: "foo", title: "bar" }] 13 } 14 ]; 15 16 // promise_tests because we need to wait for promise_setup 17 function notification_instance_test(createFn, testTitle) { 18 let n; 19 promise_test(async t => { 20 n = await createFn(t); 21 }, `${testTitle}: Setup`); 22 promise_test(async () => { 23 assert_equals(n.title, "Radio check") 24 }, `${testTitle}: Attribute exists with expected value: title`) 25 promise_test(async () => { 26 assert_equals(n.dir, "ltr") 27 }, `${testTitle}: Attribute exists with expected value: dir`) 28 promise_test(async () => { 29 assert_equals(n.lang, "aa") 30 }, `${testTitle}: Attribute exists with expected value: lang`) 31 promise_test(async () => { 32 assert_equals(n.body, "This is a radio check.") 33 }, `${testTitle}: Attribute exists with expected value: body`) 34 promise_test(async () => { 35 assert_equals(n.tag, "radio_check999") 36 }, `${testTitle}: Attribute exists with expected value: tag`) 37 promise_test(async () => { 38 assert_equals(n.icon, `${location.origin}/icon.png`) 39 }, `${testTitle}: Attribute exists with expected value: icon`) 40 promise_test(async () => { 41 assert_true(n.requireInteraction); 42 }, `${testTitle}: Attribute exists with expected value: requireInteraction`) 43 promise_test(async () => { 44 assert_true(n.silent); 45 }, `${testTitle}: Attribute exists with expected value: silent`) 46 promise_test(async () => { 47 assert_custom_data(n.data); 48 }, `${testTitle}: Attribute exists with expected value: data`) 49 promise_test(async () => { 50 for (const [i, action] of n.actions.entries()) { 51 assert_object_equals(action, notification_args[1].actions[i]); 52 } 53 }, `${testTitle}: Attribute exists with expected value: actions`) 54 }