mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:27:35 +00:00
LibJS: Define the Intl.Collator's compare function name to be empty
This commit is contained in:
parent
f3c4146140
commit
96459e4b3a
2 changed files with 5 additions and 0 deletions
|
@ -26,6 +26,7 @@ void CollatorCompareFunction::initialize(GlobalObject& global_object)
|
|||
{
|
||||
auto& vm = global_object.vm();
|
||||
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 10.3.3.2 CompareStrings ( collator, x, y ), https://tc39.es/ecma402/#sec-collator-comparestrings
|
||||
|
|
|
@ -3,6 +3,10 @@ describe("correct behavior", () => {
|
|||
expect(new Intl.Collator().compare).toHaveLength(2);
|
||||
});
|
||||
|
||||
test("name is empty string", () => {
|
||||
expect(new Intl.Collator().compare.name).toBe("");
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const collator = new Intl.Collator();
|
||||
expect(collator.compare("", "")).toBe(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue