test_dom_storage_event.html (1981B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for DOM StorageEvent</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <body> 9 <p id="display"></p> 10 <div id="content" style="display: none"> 11 12 </div> 13 <pre id="test"> 14 <script type="application/javascript"> 15 16 const kTests = [ 17 { createEventArg: "StorageEvent", 18 type: "aaa", bubbles: true, cancelable: true, 19 key: null, oldValue: 'a', newValue: 'b', url: 'c', storageArea: null }, 20 21 { createEventArg: "storageevent", 22 type: "bbb", bubbles: false, cancelable: true, 23 key: 'key', oldValue: null, newValue: 'b', url: 'c', storageArea: null }, 24 25 { createEventArg: "Storageevent", 26 type: "ccc", bubbles: true, cancelable: false, 27 key: 'key', oldValue: 'a', newValue: null, url: 'c', storageArea: null }, 28 29 { createEventArg: "storageEvent", 30 type: "ddd", bubbles: false, cancelable: false, 31 key: 'key', oldValue: 'a', newValue: 'b', url: '', storageArea: null }, 32 33 { createEventArg: "StorageEvent", 34 type: "eee", bubbles: true, cancelable: true, 35 key: 'key', oldValue: 'a', newValue: 'b', url: 'c', storageArea: null }, 36 37 { createEventArg: "storageevent", 38 type: "fff", bubbles: false, cancelable: true, 39 key: null, oldValue: null, newValue: null, url: '', storageArea: null }, 40 ]; 41 42 for (var i = 0; i < kTests.length; i++) { 43 var description = "test, Index: " + i + ", "; 44 const kTest = kTests[i]; 45 var e = document.createEvent(kTest.createEventArg); 46 e.initStorageEvent(kTest.type, kTest.bubbles, kTest.cancelable, 47 kTest.key, kTest.oldValue, kTest.newValue, kTest.url, 48 kTest.storageArea); 49 50 for (var attr in kTest) { 51 if (attr == 'createEventArg') 52 continue; 53 54 is(e[attr], kTest[attr], description + attr + " returns wrong value"); 55 } 56 is(e.isTrusted, false, description + "isTrusted returns wrong value"); 57 } 58 59 </script> 60 </pre> 61 </body> 62 </html>