54 lines
3.1 KiB
HTML
54 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
|
|
description("This tests the constructor for the HashChangeEvent DOM class.");
|
|
|
|
// No initializer is passed.
|
|
shouldBe("new HashChangeEvent('eventType').bubbles", "false");
|
|
shouldBe("new HashChangeEvent('eventType').cancelable", "false");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType').oldURL", "");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType').newURL", "");
|
|
|
|
// bubbles is passed.
|
|
shouldBe("new HashChangeEvent('eventType', { bubbles: false }).bubbles", "false");
|
|
shouldBe("new HashChangeEvent('eventType', { bubbles: true }).bubbles", "true");
|
|
|
|
// cancelable is passed.
|
|
shouldBe("new HashChangeEvent('eventType', { cancelable: false }).cancelable", "false");
|
|
shouldBe("new HashChangeEvent('eventType', { cancelable: true }).cancelable", "true");
|
|
|
|
// oldURL or newURL is passed.
|
|
["oldURL", "newURL"].forEach(function (attr) {
|
|
// Strings.
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 'doremi' })." + attr, "doremi");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": '' })." + attr, "");
|
|
|
|
// Non-strings.
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": undefined })." + attr, "");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": null })." + attr, "null");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": false })." + attr, "false");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": true })." + attr, "true");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 12345 })." + attr, "12345");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 18446744073709551615 })." + attr, "18446744073709552000");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": NaN })." + attr, "NaN");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": [] })." + attr, "");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": [1, 2, 3] })." + attr, "1,2,3");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": {doremi: 12345} })." + attr, "[object Object]");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": {valueOf: function () { return 'doremi'; } } })." + attr, "[object Object]");
|
|
});
|
|
|
|
// All initializers are passed.
|
|
shouldBe("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).bubbles", "true");
|
|
shouldBe("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).cancelable", "true");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).oldURL", "doremi");
|
|
shouldBeEqualToString("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).newURL", "andre");
|
|
</script>
|
|
<script src="../../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|