930abaf5d7
Fixes pixel rounding when calculating css transformations for overlay items. Also fixes issue where `editor.instanceState.devicePixelRatio` wasn't properly updating. TLDR; `width * window.devicePixelRatio` should be integer to avoid rounding. `--tl-dpr-multiple` is smallest integer to multiply `window.devicePixelRatio` such that its product is an integer. #1852 #1836 #1834 ### Change Type - [x] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [ ] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan Would need to add a test checking when `window.devicePixelRatio` changes, that `editor.instanceState.devicePixelRatio` is equal. --------- Co-authored-by: David Sheldrick <d.j.sheldrick@gmail.com>
35 lines
833 B
JavaScript
35 lines
833 B
JavaScript
require('fake-indexeddb/auto')
|
|
require('jest-canvas-mock')
|
|
global.ResizeObserver = require('resize-observer-polyfill')
|
|
global.crypto ??= new (require('@peculiar/webcrypto').Crypto)()
|
|
global.FontFace = class FontFace {
|
|
load() {
|
|
return Promise.resolve()
|
|
}
|
|
}
|
|
|
|
document.fonts = {
|
|
add: () => {},
|
|
delete: () => {},
|
|
forEach: () => {},
|
|
[Symbol.iterator]: () => [][Symbol.iterator](),
|
|
}
|
|
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: jest.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // Deprecated
|
|
removeListener: jest.fn(), // Deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
})),
|
|
})
|
|
|
|
Object.defineProperty(global.URL, 'createObjectURL', {
|
|
writable: true,
|
|
value: jest.fn(),
|
|
})
|