Files
brave-core/components/test/testPolyfills.ts
T
Pete Miller 54238e7b90 [AI Chat] Fix attachment progress not shown (#36583)
* [AI Chat] Fix attachment progress not shown

- Fix https://github.com/brave/brave-browser/issues/55694

When attaching any files, no progress is being shown. This is a regression caused by the following, either one of which alone stops progress being shown:
- https://github.com/brave/brave-core/pull/35816
- https://github.com/brave/brave-core/pull/30429
2026-05-22 21:08:59 +00:00

42 lines
1015 B
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)
}
}