summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-08 20:35:33 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-08 23:08:27 +0100
commit2e968700aa7346ea3614f32942bec1d7fc004da4 (patch)
tree3c83ad8c74931d9c5ffbd6cba9af56a56d2e8d50 /Userland
parentab1caad1e95acafa04fc4a65a75810d3763407c6 (diff)
downloadserenity-2e968700aa7346ea3614f32942bec1d7fc004da4.zip
LibJS: Implement Temporal.TimeZone.prototype[@@toStringTag]
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp5
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.prototype.@@toStringTag.js3
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp
index bd65c1d067..cef22d62d2 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp
@@ -18,6 +18,11 @@ TimeZonePrototype::TimeZonePrototype(GlobalObject& global_object)
void TimeZonePrototype::initialize(GlobalObject& global_object)
{
Object::initialize(global_object);
+
+ auto& vm = this->vm();
+
+ // 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag
+ define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.TimeZone"), Attribute::Configurable);
}
}
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.prototype.@@toStringTag.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.prototype.@@toStringTag.js
new file mode 100644
index 0000000000..50636ff368
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.prototype.@@toStringTag.js
@@ -0,0 +1,3 @@
+test("basic functionality", () => {
+ expect(Temporal.TimeZone.prototype[Symbol.toStringTag]).toBe("Temporal.TimeZone");
+});