| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("This tests the constructor for the MIDIMessageEvent DOM class."); |
| |
| // No initializer is passed. |
| shouldBe("new MIDIMessageEvent('eventType').bubbles", "false"); |
| shouldBe("new MIDIMessageEvent('eventType').cancelable", "false"); |
| shouldBe("new MIDIMessageEvent('eventType').data", "null"); |
| |
| // bubbles is passed. |
| shouldBe("new MIDIMessageEvent('eventType', { bubbles: false }).bubbles", "false"); |
| shouldBe("new MIDIMessageEvent('eventType', { bubbles: true }).bubbles", "true"); |
| |
| // cancelable is passed. |
| shouldBe("new MIDIMessageEvent('eventType', { cancelable: false }).cancelable", "false"); |
| shouldBe("new MIDIMessageEvent('eventType', { cancelable: true }).cancelable", "true"); |
| |
| // data is passed. |
| var data = new Uint8Array(16); |
| shouldEvaluateTo("new MIDIMessageEvent('eventType', { data: data }).data", data); |
| |
| // All initializers are passed. |
| data = new Uint8Array(3); |
| shouldBe("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, data: data }).bubbles", "true"); |
| shouldBe("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, data: data }).cancelable", "true"); |
| shouldEvaluateTo("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, data: data }).data", data); |
| |
| if (window.SharedArrayBuffer) { |
| data = new Uint8Array(new SharedArrayBuffer(3)); |
| shouldThrow("new MIDIMessageEvent('eventType', { data: data })"); |
| } |
| |
| </script> |
| </body> |
| </html> |