Changes https://github.com/brave/leo/compare/075a3f9ed76e03bdc3f63d7dc4a7269e6dbdec29...e4af287f27ef5bb412a57a057d0edbbc81326168 - **BREAKING** [Icons]: Update icons from Figma ([#1378](https://github.com/brave/leo/pull/1378)) - [svelte5]: Use unmount not destroy ([#1399](https://github.com/brave/leo/pull/1399)) - [Svelte]: Minor bump ([#1398](https://github.com/brave/leo/pull/1398)) - **BREAKING** [Svelte]: Upgrade to Svelte 5 ([#1078](https://github.com/brave/leo/pull/1078)) - chore(deps): updates deps and adds .npmrc with min-release-age ([#1391](https://github.com/brave/leo/pull/1391)) - [Toggle]: Remove :hover effect on mobile ([#1390](https://github.com/brave/leo/pull/1390)) - [Radio]: Remove :hover effect on mobile ([#1389](https://github.com/brave/leo/pull/1389)) - [Checkbox]: Disable `:hover` effect on mobile ([#1388](https://github.com/brave/leo/pull/1388)) - [Button]: Disable :hover state on mobile ([#1387](https://github.com/brave/leo/pull/1387)) - Add transform transition and press scale to button ([#1385](https://github.com/brave/leo/pull/1385)) - Navigation style updates ([#1386](https://github.com/brave/leo/pull/1386)) - Bump postcss from 8.5.6 to 8.5.14 in /examples/example-ui-react ([#1383](https://github.com/brave/leo/pull/1383)) - Bump postcss from 8.5.6 to 8.5.14 ([#1384](https://github.com/brave/leo/pull/1384))
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
/* Copyright (c) 2018 The Brave Authors. All rights reserved.
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
import { getMockChrome, getMockLoadTimeData } from './testData'
|
|
|
|
window.alert = jest.fn()
|
|
|
|
global.decodeURIComponent = () => 'test'
|
|
|
|
window.requestAnimationFrame = function (cb: FrameRequestCallback) {
|
|
return window.setTimeout(cb, 0)
|
|
}
|
|
|
|
const windowAsAny = window as any
|
|
|
|
windowAsAny.chrome = getMockChrome()
|
|
windowAsAny.loadTimeData = getMockLoadTimeData()
|
|
|
|
windowAsAny.ResizeObserver = class ResizeObserverPolyfill {
|
|
observe() {}
|
|
|
|
unobserve() {}
|
|
|
|
disconnect() {}
|
|
}
|
|
|
|
windowAsAny.IntersectionObserver = class IntersectionObserverPolyfill {
|
|
observe() {}
|
|
|
|
unobserve() {}
|
|
|
|
disconnect() {}
|
|
}
|
|
|
|
if (typeof File.prototype.arrayBuffer !== 'function') {
|
|
File.prototype.arrayBuffer = async function () {
|
|
return new ArrayBuffer(0)
|
|
}
|
|
}
|
|
|
|
// jsdom does not implement the Web Animations API. Svelte 5's transition system
|
|
// calls Element.animate() during mount/unmount and assigns onfinish to advance
|
|
// its state machine, so the stub fires onfinish on the next microtask.
|
|
Element.prototype.animate = function () {
|
|
const animation = {
|
|
cancel: () => {},
|
|
finish: () => {},
|
|
play: () => {},
|
|
pause: () => {},
|
|
reverse: () => {},
|
|
onfinish: null as (() => void) | null,
|
|
oncancel: null as (() => void) | null,
|
|
finished: Promise.resolve(),
|
|
addEventListener: () => {},
|
|
removeEventListener: () => {}
|
|
}
|
|
queueMicrotask(() => animation.onfinish?.())
|
|
return animation as unknown as Animation
|
|
}
|