diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-15 23:24:51 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-16 01:07:01 +0100 |
commit | 23766f28db52e0523aa436e8bd9c3c82ec21a15e (patch) | |
tree | e44a82440a0e58ddd4b8f2067b13ba93af0b2ff2 /Userland | |
parent | 7921d8ba916fc578b12c416bb05fead11827493d (diff) | |
download | serenity-23766f28db52e0523aa436e8bd9c3c82ec21a15e.zip |
LibJS: Implement Temporal.Duration.prototype[@@toStringTag]
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.@@toStringTag.js | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index b746949d2a..7310ed3a14 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -18,6 +18,11 @@ DurationPrototype::DurationPrototype(GlobalObject& global_object) void DurationPrototype::initialize(GlobalObject& global_object) { Object::initialize(global_object); + + auto& vm = this->vm(); + + // 7.3.2 Temporal.Duration.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype-@@tostringtag + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Duration"), Attribute::Configurable); } } diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.@@toStringTag.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.@@toStringTag.js new file mode 100644 index 0000000000..93c0c32a94 --- /dev/null +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.@@toStringTag.js @@ -0,0 +1,3 @@ +test("basic functionality", () => { + expect(Temporal.Duration.prototype[Symbol.toStringTag]).toBe("Temporal.Duration"); +}); |