nx-js / observer-util

Transparent reactivity with 100% language coverage. Made with ❤️ and ES6 Proxies.
MIT License
1.2k stars 94 forks source link

should observe explicit array length changes #51

Open YousefED opened 3 years ago

YousefED commented 3 years ago

The following scenario doesn't work (explicitly deleting items by modifying array.length)

  it("should observe explicit array length changes", () => {
    let dummy;
    const list = observable(["Hello", "World"]);
    observe(() => {
      dummy = list[0];
    });

    expect(dummy).to.equal("Hello");
    list.length = 0;
    expect(dummy).to.equal(undefined);
  });