diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/console/console-namespace-object-class-string.any.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/console/console-namespace-object-class-string.any.js')
-rw-r--r-- | testing/web-platform/tests/console/console-namespace-object-class-string.any.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/web-platform/tests/console/console-namespace-object-class-string.any.js b/testing/web-platform/tests/console/console-namespace-object-class-string.any.js new file mode 100644 index 0000000000..d3ff7f7d07 --- /dev/null +++ b/testing/web-platform/tests/console/console-namespace-object-class-string.any.js @@ -0,0 +1,40 @@ +"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"); |