Files
tubestation/testing/web-platform/tests/console/console-namespace-object-class-string.any.js
Philip Jägenstedt e47af353cf Bug 1734572 [wpt PR 31148] - Update URLs to Web IDL, a=testonly
Automatic update from web-platform-tests
Update URLs to Web IDL

Only two instances of "heycam.github.io" remain now.

interfaces/WebIDL.idl will be updated when webref is updated next time,
as it has already been fixed there:
7c04f47557

resources/webidl2/lib/webidl2.js is third-party code and will be updated
at some point in the future.

--

wpt-commits: 9a88dfd5bf623a8cb326c154b27f1e3494e11022
wpt-pr: 31148
2021-10-14 04:45:19 +00:00

41 lines
1.8 KiB
JavaScript

"use strict";
// https://webidl.spec.whatwg.org/#es-namespaces
// https://console.spec.whatwg.org/#console-namespace
test(() => {
assert_own_property(console, Symbol.toStringTag);
const propDesc = Object.getOwnPropertyDescriptor(console, Symbol.toStringTag);
assert_equals(propDesc.value, "console", "value");
assert_equals(propDesc.writable, false, "writable");
assert_equals(propDesc.enumerable, false, "enumerable");
assert_equals(propDesc.configurable, true, "configurable");
}, "@@toStringTag exists on the namespace object with the appropriate descriptor");
test(() => {
assert_equals(console.toString(), "[object console]");
assert_equals(Object.prototype.toString.call(console), "[object console]");
}, "Object.prototype.toString applied to the namespace object");
test(t => {
assert_own_property(console, Symbol.toStringTag, "Precondition: @@toStringTag on the namespace object");
t.add_cleanup(() => {
Object.defineProperty(console, Symbol.toStringTag, { value: "console" });
});
Object.defineProperty(console, Symbol.toStringTag, { value: "Test" });
assert_equals(console.toString(), "[object Test]");
assert_equals(Object.prototype.toString.call(console), "[object Test]");
}, "Object.prototype.toString applied after modifying the namespace object's @@toStringTag");
test(t => {
assert_own_property(console, Symbol.toStringTag, "Precondition: @@toStringTag on the namespace object");
t.add_cleanup(() => {
Object.defineProperty(console, Symbol.toStringTag, { value: "console" });
});
assert_true(delete console[Symbol.toStringTag]);
assert_equals(console.toString(), "[object Object]");
assert_equals(Object.prototype.toString.call(console), "[object Object]");
}, "Object.prototype.toString applied after deleting @@toStringTag");