How to use the resize-observer-polyfill.prototype function in resize-observer-polyfill

To help you get started, we’ve selected a few resize-observer-polyfill examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ZeeCoder / container-query / packages / container-query / src / Container.spec.js View on Github external
test("should not call adjust if disabled by the options", () => {
  const containerElement = {
    parentNode: document.createElement("div")
  };

  const meta = {};

  new Container(containerElement, meta, {
    adjustOnResize: false,
    adjustOnInstantiation: false
  });

  expect(ResizeObserver).toHaveBeenCalledTimes(1);
  expect(ResizeObserver.prototype.observe).toHaveBeenCalledTimes(0);
  expect(raf).toHaveBeenCalledTimes(0);
  expect(processMeta).toHaveBeenCalledTimes(1);
  expect(processMeta.mock.calls[0][0]).toBe(meta);
  expect(adjustContainer).toHaveBeenCalledTimes(0);
});
github ZeeCoder / container-query / packages / container-query / src / Container.spec.js View on Github external
beforeEach(() => {
  raf.mockClear();
  processMeta.mockClear();
  adjustContainer.mockClear();
  ResizeObserver.prototype.observe.mockClear();
  ResizeObserver.prototype.unobserve.mockClear();
  containerRegistry.get.mockClear();
  containerRegistry.set.mockClear();
  containerRegistry.has.mockClear();
  containerRegistry.delete.mockClear();
});