+
,
);
@@ -17,7 +19,7 @@ describe('', () => {
});
it('does not try to scroll if there is no scrollable content', () => {
- render();
+ render();
fireEvent.click(screen.getByText('notifications'));
});
});
diff --git a/app/javascript/mastodon/features/ui/components/column.jsx b/app/javascript/mastodon/features/ui/components/column.jsx
index d667f42d9..b6c09b62c 100644
--- a/app/javascript/mastodon/features/ui/components/column.jsx
+++ b/app/javascript/mastodon/features/ui/components/column.jsx
@@ -3,15 +3,15 @@ import { PureComponent } from 'react';
import { debounce } from 'lodash';
+import ColumnHeader from '../../../components/column_header';
import { isMobile } from '../../../is_mobile';
import { scrollTop } from '../../../scroll';
-import ColumnHeader from './column_header';
-
export default class Column extends PureComponent {
static propTypes = {
heading: PropTypes.string,
+ alwaysShowBackButton: PropTypes.bool,
icon: PropTypes.string,
iconComponent: PropTypes.func,
children: PropTypes.node,
@@ -51,13 +51,14 @@ export default class Column extends PureComponent {
};
render () {
- const { heading, icon, iconComponent, children, active, hideHeadingOnMobile } = this.props;
+ const { heading, icon, iconComponent, children, active, hideHeadingOnMobile, alwaysShowBackButton } = this.props;
const showHeading = heading && (!hideHeadingOnMobile || (hideHeadingOnMobile && !isMobile(window.innerWidth)));
const columnHeaderId = showHeading && heading.replace(/ /g, '-');
+
const header = showHeading && (
-
+
);
return (
{
- this.props.onClick();
- };
-
- render () {
- const { icon, iconComponent, type, active, columnHeaderId } = this.props;
- let iconElement = '';
-
- if (icon) {
- iconElement = ;
- }
-
- return (
-
-
-
- );
- }
-
-}
diff --git a/app/javascript/mastodon/test_helpers.tsx b/app/javascript/mastodon/test_helpers.tsx
new file mode 100644
index 000000000..689589556
--- /dev/null
+++ b/app/javascript/mastodon/test_helpers.tsx
@@ -0,0 +1,62 @@
+import PropTypes from 'prop-types';
+import type { PropsWithChildren } from 'react';
+import { Component } from 'react';
+
+import { IntlProvider } from 'react-intl';
+
+import { MemoryRouter } from 'react-router';
+
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { render as rtlRender } from '@testing-library/react';
+
+class FakeIdentityWrapper extends Component<
+ PropsWithChildren<{ signedIn: boolean }>
+> {
+ static childContextTypes = {
+ identity: PropTypes.shape({
+ signedIn: PropTypes.bool.isRequired,
+ accountId: PropTypes.string,
+ disabledAccountId: PropTypes.string,
+ accessToken: PropTypes.string,
+ }).isRequired,
+ };
+
+ getChildContext() {
+ return {
+ identity: {
+ signedIn: this.props.signedIn,
+ accountId: '123',
+ accessToken: 'test-access-token',
+ },
+ };
+ }
+
+ render() {
+ return this.props.children;
+ }
+}
+
+function render(
+ ui: React.ReactElement,
+ { locale = 'en', signedIn = true, ...renderOptions } = {},
+) {
+ const Wrapper = (props: { children: React.ReactElement }) => {
+ return (
+
+
+
+ {props.children}
+
+
+
+ );
+ };
+ return rtlRender(ui, { wrapper: Wrapper, ...renderOptions });
+}
+
+// re-export everything
+// eslint-disable-next-line import/no-extraneous-dependencies
+export * from '@testing-library/react';
+
+// override render method
+export { render };
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index b8e6af0aa..1e341680e 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -3137,20 +3137,6 @@ $ui-header-height: 55px;
margin-inline-end: 5px;
}
-.column-back-button--slim {
- position: relative;
-}
-
-.column-back-button--slim-button {
- cursor: pointer;
- flex: 0 0 auto;
- font-size: 16px;
- padding: 15px;
- position: absolute;
- inset-inline-end: 0;
- top: -50px;
-}
-
.react-toggle {
display: inline-block;
position: relative;