mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
fix: regression in typings
This commit is contained in:
7
framework/core/js/src/@types/global.d.ts
vendored
7
framework/core/js/src/@types/global.d.ts
vendored
@@ -112,6 +112,13 @@ interface FlarumObject {
|
|||||||
|
|
||||||
declare const flarum: FlarumObject;
|
declare const flarum: FlarumObject;
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
/**
|
||||||
|
* Whether we are in testing mode or not.
|
||||||
|
*/
|
||||||
|
testing?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
// Extend JQuery with our custom functions, defined with $.fn
|
// Extend JQuery with our custom functions, defined with $.fn
|
||||||
interface JQuery {
|
interface JQuery {
|
||||||
/**
|
/**
|
||||||
|
@@ -36,7 +36,7 @@ export default class Avatar<CustomAttrs extends IAvatarAttrs = IAvatarAttrs> ext
|
|||||||
}
|
}
|
||||||
|
|
||||||
content = username.charAt(0).toUpperCase();
|
content = username.charAt(0).toUpperCase();
|
||||||
attrs.style = !process.env.testing && { '--avatar-bg': user.color() };
|
attrs.style = !window.testing && { '--avatar-bg': user.color() };
|
||||||
}
|
}
|
||||||
|
|
||||||
return <span {...attrs}>{content}</span>;
|
return <span {...attrs}>{content}</span>;
|
||||||
|
@@ -34,7 +34,7 @@ export default class Badge<CustomAttrs extends IBadgeAttrs = IBadgeAttrs> extend
|
|||||||
|
|
||||||
const newStyle = { ...style };
|
const newStyle = { ...style };
|
||||||
|
|
||||||
if (!process.env.testing) {
|
if (!window.testing) {
|
||||||
newStyle['--badge-bg'] = color;
|
newStyle['--badge-bg'] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
|
|||||||
data-modal-number={i}
|
data-modal-number={i}
|
||||||
role="dialog"
|
role="dialog"
|
||||||
aria-modal="true"
|
aria-modal="true"
|
||||||
style={!process.env.testing && { '--modal-number': i }}
|
style={!window.testing && { '--modal-number': i }}
|
||||||
aria-hidden={this.attrs.state.modal !== modal && 'true'}
|
aria-hidden={this.attrs.state.modal !== modal && 'true'}
|
||||||
>
|
>
|
||||||
{!!Tag && [
|
{!!Tag && [
|
||||||
@@ -66,7 +66,7 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
|
|||||||
className="Modal-backdrop backdrop"
|
className="Modal-backdrop backdrop"
|
||||||
ontransitionend={this.onBackdropTransitionEnd.bind(this)}
|
ontransitionend={this.onBackdropTransitionEnd.bind(this)}
|
||||||
data-showing={!!this.attrs.state.modalList.length || this.attrs.state.loadingModal}
|
data-showing={!!this.attrs.state.modalList.length || this.attrs.state.loadingModal}
|
||||||
style={!process.env.testing && { '--modal-count': this.attrs.state.modalList.length + Number(this.attrs.state.loadingModal) }}
|
style={!window.testing && { '--modal-count': this.attrs.state.modalList.length + Number(this.attrs.state.loadingModal) }}
|
||||||
>
|
>
|
||||||
{this.attrs.state.loadingModal && <LoadingIndicator />}
|
{this.attrs.state.loadingModal && <LoadingIndicator />}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -30,7 +30,7 @@ export default class UserCard extends Component {
|
|||||||
const color = user.color();
|
const color = user.color();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classList('UserCard', this.attrs.className)} style={color && !process.env.testing && { '--usercard-bg': color }}>
|
<div className={classList('UserCard', this.attrs.className)} style={color && !window.testing && { '--usercard-bg': color }}>
|
||||||
<div className="darkenBackground">
|
<div className="darkenBackground">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="UserCard-profile">{this.profileItems().toArray()}</div>
|
<div className="UserCard-profile">{this.profileItems().toArray()}</div>
|
||||||
|
@@ -12,8 +12,6 @@ import jsdom from 'jsdom';
|
|||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
dayjs.extend(localizedFormat);
|
dayjs.extend(localizedFormat);
|
||||||
|
|
||||||
process.env.testing = true;
|
|
||||||
|
|
||||||
const dom = new jsdom.JSDOM('', {
|
const dom = new jsdom.JSDOM('', {
|
||||||
pretendToBeVisual: false,
|
pretendToBeVisual: false,
|
||||||
});
|
});
|
||||||
@@ -26,6 +24,7 @@ global.requestAnimationFrame = (callback) => callback();
|
|||||||
|
|
||||||
// Some other needed pollyfills.
|
// Some other needed pollyfills.
|
||||||
window.$ = jquery;
|
window.$ = jquery;
|
||||||
|
window.testing = true;
|
||||||
window.m = m;
|
window.m = m;
|
||||||
window.$.fn.tooltip = () => {};
|
window.$.fn.tooltip = () => {};
|
||||||
window.matchMedia = () => ({
|
window.matchMedia = () => ({
|
||||||
|
Reference in New Issue
Block a user