refactor: Continue refactoring after migrating to rsbuild
This commit is contained in:
120 files changed
+751
-483
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Article } from './Article';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Article', () => {
|
||||
const props = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Breadcrumbs } from './Breadcrumbs';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
import { Link } from '../Link/Link';
|
||||
|
||||
describe('components/Breadcrumbs', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Button } from './Button';
|
||||
import { render, screen, fireEvent } from '../../test-utils';
|
||||
import { render, screen, fireEvent } from '../../lib/testing';
|
||||
|
||||
describe('components/Button', () => {
|
||||
it('renders correctly as a button by default', () => {
|
||||
|
||||
@@ -73,13 +73,18 @@ export const Code = memo(function Code({
|
||||
|
||||
if (context?.isInCodeBlock) {
|
||||
const { showLineNumbers } = context;
|
||||
|
||||
|
||||
let content = children;
|
||||
if (typeof children === 'string') {
|
||||
content = children.trimEnd().split('\n').map((line, i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<span key={i} className="block min-h-[1.5em]">{line || '\n'}</span>
|
||||
));
|
||||
content = children
|
||||
.trimEnd()
|
||||
.split('\n')
|
||||
.map((line, i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<span key={i} className="block min-h-[1.5em]">
|
||||
{line || '\n'}
|
||||
</span>
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { Container } from './Container';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Container', () => {
|
||||
it('handles onPress event', async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Image } from './Image';
|
||||
import { render, screen, fireEvent } from '../../test-utils';
|
||||
import { render, screen, fireEvent } from '../../lib/testing';
|
||||
|
||||
describe('components/Image', () => {
|
||||
const defaultProps = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from './Link';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Link', () => {
|
||||
it('renders correctly as a link when href is provided', () => {
|
||||
|
||||
@@ -79,4 +79,4 @@ export const Markdown = Object.assign(MarkdownComponent, {
|
||||
Pre: MarkdownPre,
|
||||
Hr: MarkdownHR,
|
||||
Img: MarkdownImg,
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Paragraph } from './Paragraph';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Paragraph', () => {
|
||||
it('renders as a p tag by default', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Stack } from './Stack';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Stack', () => {
|
||||
it('renders children correctly', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Stub } from './Stub';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Stub', () => {
|
||||
it('renders correctly with default props', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Text } from './Text';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Text', () => {
|
||||
it('renders children correctly', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Time } from './Time';
|
||||
import { render, screen } from '../../test-utils';
|
||||
import { render, screen } from '../../lib/testing';
|
||||
|
||||
describe('components/Time', () => {
|
||||
it('renders correctly with a Date object', () => {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in new issue
Block a user