From ac67077b574bd4417ec8e5c66655b45780a4ebed Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Thu, 3 Nov 2022 20:54:54 +0000 Subject: [PATCH] LibJS: Fix length of PlainDateTime.withPlainTime withPlainTime's argument is optional, so the length of the function is actually 0. --- .../LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp | 2 +- .../PlainDateTime/PlainDateTime.prototype.withPlainTime.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 22cae0abd9..a7cfb735e7 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -59,7 +59,7 @@ void PlainDateTimePrototype::initialize(Realm& realm) u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.with, with, 1, attr); - define_native_function(realm, vm.names.withPlainTime, with_plain_time, 1, attr); + define_native_function(realm, vm.names.withPlainTime, with_plain_time, 0, attr); define_native_function(realm, vm.names.withPlainDate, with_plain_date, 1, attr); define_native_function(realm, vm.names.withCalendar, with_calendar, 1, attr); define_native_function(realm, vm.names.add, add, 1, attr); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.withPlainTime.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.withPlainTime.js index 6d5ba6376f..e32f675d29 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.withPlainTime.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.withPlainTime.js @@ -1,6 +1,6 @@ describe("correct behavior", () => { - test("length is 1", () => { - expect(Temporal.PlainDateTime.prototype.withPlainTime).toHaveLength(1); + test("length is 0", () => { + expect(Temporal.PlainDateTime.prototype.withPlainTime).toHaveLength(0); }); test("basic functionality", () => {