mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
LibJS: Use array-like size for IndexedProperties::is_empty()
Some things, like (the non-generic version of) Array.prototype.pop(), check is_empty() to determine whether an action, like removing elements, can be performed. We need to know the array-like size for that, not the size of the underlying storage, which can be different - and is not something IndexedProperties should expose so I removed its size(). Fixes #3948.
This commit is contained in:
parent
0bb66890c8
commit
dec6c0a207
2 changed files with 7 additions and 2 deletions
|
@ -7,6 +7,12 @@ describe("normal behavior", () => {
|
|||
var a = [1, 2, 3];
|
||||
expect(a.pop()).toBe(3);
|
||||
expect(a).toEqual([1, 2]);
|
||||
expect(a.pop()).toBe(2);
|
||||
expect(a).toEqual([1]);
|
||||
expect(a.pop()).toBe(1);
|
||||
expect(a).toEqual([]);
|
||||
expect(a.pop()).toBeUndefined();
|
||||
expect(a).toEqual([]);
|
||||
});
|
||||
|
||||
test("empty array", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue