<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/shared.js"></script>
</head>
<body>
<script>

shouldBeEqualToNumber("IDBVersionChangeEvent.length", 1);

evalAndLog("event = new IDBVersionChangeEvent('foo');");

shouldBeTrue("event instanceof IDBVersionChangeEvent");
shouldBeEqualToString("event.toString()", "[object IDBVersionChangeEvent]");
shouldBeEqualToNumber("event.oldVersion", 0);
shouldBeNull("event.newVersion");

evalAndLog("event = new IDBVersionChangeEvent('bar', { oldVersion: 2 });");
shouldBeEqualToNumber("event.oldVersion", 2);
shouldBeNull("event.newVersion");

evalAndLog("event = new IDBVersionChangeEvent('bar', { oldVersion: 6, newVersion: null });");
shouldBeEqualToNumber("event.oldVersion", 6);
shouldBeNull("event.newVersion");

evalAndLog("event = new IDBVersionChangeEvent('bar', { oldVersion: 4, newVersion: undefined });");
shouldBeEqualToNumber("event.oldVersion", 4);
shouldBeNull("event.newVersion");

evalAndLog("event = new IDBVersionChangeEvent('bar', { oldVersion: 0, newVersion: 17 });");
shouldBeEqualToNumber("event.oldVersion", 0);
shouldBeEqualToNumber("event.newVersion", 17);

evalAndLog("event = new IDBVersionChangeEvent('bar', { oldVersion: 43876528735628, newVersion: 0 });");
shouldBeEqualToNumber("event.oldVersion", 43876528735628);
shouldBeEqualToNumber("event.newVersion", 0);

evalAndLog("event = new IDBVersionChangeEvent('bar', { bubbles: true, cancelable: true, composed: true });");
shouldBeEqualToString("event.type", "bar");
shouldBeTrue("event.bubbles");
shouldBeTrue("event.cancelable");
shouldBeTrue("event.composed");

finishJSTest();

</script>
</body>
</html>
