From e43b27ca8c0acb82ddbad2a236c79dd810b451e1 Mon Sep 17 00:00:00 2001
From: thinkasany <480968828@qq.com>
Date: Tue, 7 Jan 2025 17:47:05 +0800
Subject: [PATCH] refactor: update content to section
---
src/DrawerPanel.tsx | 2 +-
src/DrawerPopup.tsx | 4 ++--
src/inter.ts | 4 ++--
tests/index.spec.tsx | 22 +++++++++++-----------
tests/ref.spec.tsx | 2 +-
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/DrawerPanel.tsx b/src/DrawerPanel.tsx
index 1bc2a8e..c69f20a 100644
--- a/src/DrawerPanel.tsx
+++ b/src/DrawerPanel.tsx
@@ -43,7 +43,7 @@ const DrawerPanel = (props: DrawerPanelProps) => {
return (
) {
id={id}
containerRef={motionRef}
prefixCls={prefixCls}
- className={classNames(className, drawerClassNames?.content)}
+ className={classNames(className, drawerClassNames?.section)}
style={{
...style,
- ...styles?.content,
+ ...styles?.section,
}}
{...pickAttrs(props, { aria: true })}
{...eventHandlers}
diff --git a/src/inter.ts b/src/inter.ts
index 587de93..f3f4fde 100644
--- a/src/inter.ts
+++ b/src/inter.ts
@@ -1,11 +1,11 @@
export interface DrawerClassNames {
mask?: string;
wrapper?: string;
- content?: string;
+ section?: string;
}
export interface DrawerStyles {
mask?: React.CSSProperties;
wrapper?: React.CSSProperties;
- content?: React.CSSProperties;
+ section?: React.CSSProperties;
}
diff --git a/tests/index.spec.tsx b/tests/index.spec.tsx
index 80bb7d6..bc3c459 100755
--- a/tests/index.spec.tsx
+++ b/tests/index.spec.tsx
@@ -301,7 +301,7 @@ describe('rc-drawer-menu', () => {
const { container } = render(
,
);
- fireEvent.keyDown(container.querySelector('.rc-drawer-content'), {
+ fireEvent.keyDown(container.querySelector('.rc-drawer-section'), {
keyCode: KeyCode.ESC,
});
expect(onClose).toHaveBeenCalled();
@@ -312,7 +312,7 @@ describe('rc-drawer-menu', () => {
const { container } = render(
,
);
- fireEvent.keyDown(container.querySelector('.rc-drawer-content'), {
+ fireEvent.keyDown(container.querySelector('.rc-drawer-section'), {
keyCode: KeyCode.ESC,
});
expect(onClose).not.toHaveBeenCalled();
@@ -376,9 +376,9 @@ describe('rc-drawer-menu', () => {
const { baseElement } = render(
,
);
- fireEvent.mouseOver(baseElement.querySelector('.rc-drawer-content'));
+ fireEvent.mouseOver(baseElement.querySelector('.rc-drawer-section'));
expect(enter).toHaveBeenCalled();
- fireEvent.mouseLeave(baseElement.querySelector('.rc-drawer-content'));
+ fireEvent.mouseLeave(baseElement.querySelector('.rc-drawer-section'));
expect(leave).toHaveBeenCalled();
});
@@ -386,10 +386,10 @@ describe('rc-drawer-menu', () => {
const { unmount } = render(
,
);
- expect(document.querySelector('.rc-drawer-content')).toHaveClass(
+ expect(document.querySelector('.rc-drawer-section')).toHaveClass(
'customer-className',
);
- expect(document.querySelector('.rc-drawer-content')).toHaveAttribute(
+ expect(document.querySelector('.rc-drawer-section')).toHaveAttribute(
'id',
'customer-id',
);
@@ -430,7 +430,7 @@ describe('rc-drawer-menu', () => {
classNames={{
wrapper: 'customer-wrapper',
mask: 'customer-mask',
- content: 'customer-content',
+ section: 'customer-section',
}}
open
/>,
@@ -441,8 +441,8 @@ describe('rc-drawer-menu', () => {
expect(document.querySelector('.rc-drawer-mask')).toHaveClass(
'customer-mask',
);
- expect(document.querySelector('.rc-drawer-content')).toHaveClass(
- 'customer-content',
+ expect(document.querySelector('.rc-drawer-section')).toHaveClass(
+ 'customer-section',
);
unmount();
});
@@ -452,7 +452,7 @@ describe('rc-drawer-menu', () => {
styles={{
wrapper: { background: 'red' },
mask: { background: 'blue' },
- content: { background: 'green' },
+ section: { background: 'green' },
}}
open
/>,
@@ -463,7 +463,7 @@ describe('rc-drawer-menu', () => {
expect(document.querySelector('.rc-drawer-mask')).toHaveStyle(
'background: blue',
);
- expect(document.querySelector('.rc-drawer-content')).toHaveStyle(
+ expect(document.querySelector('.rc-drawer-section')).toHaveStyle(
'background: green',
);
unmount();
diff --git a/tests/ref.spec.tsx b/tests/ref.spec.tsx
index ec1c8cf..cdda496 100755
--- a/tests/ref.spec.tsx
+++ b/tests/ref.spec.tsx
@@ -20,6 +20,6 @@ describe('Drawer.ref', () => {
jest.runAllTimers();
});
- expect(panelRef.current).toHaveClass('rc-drawer-content');
+ expect(panelRef.current).toHaveClass('rc-drawer-section');
});
});