From 86ab6e3a427e51e54ed72fb8817ee59ce04840d8 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Thu, 9 Mar 2023 19:42:38 +0800 Subject: [PATCH] Revert "fix: quote in key should not cause tabs crash (#655)" This reverts commit 18550e069f3a2311e93370ae4aaa15d7ff849fe5. --- src/TabNavList/TabNode.tsx | 3 +-- src/TabNavList/index.tsx | 4 ++-- src/util.ts | 5 ----- tests/index.test.tsx | 4 ---- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/TabNavList/TabNode.tsx b/src/TabNavList/TabNode.tsx index 00e4aa02..932b32a1 100644 --- a/src/TabNavList/TabNode.tsx +++ b/src/TabNavList/TabNode.tsx @@ -2,7 +2,6 @@ import classNames from 'classnames'; import KeyCode from 'rc-util/lib/KeyCode'; import * as React from 'react'; import type { EditableConfig, Tab } from '../interface'; -import { genDataNodeKey } from '../util'; export interface TabNodeProps { id: string; @@ -57,7 +56,7 @@ function TabNode({
) { setTabSizes(() => { const newSizes: TabSizeMap = new Map(); tabs.forEach(({ key }) => { - const btnNode = tabListRef.current?.querySelector(`[data-node-key="${genDataNodeKey(key)}"]`); + const btnNode = tabListRef.current?.querySelector(`[data-node-key="${key}"]`); if (btnNode) { newSizes.set(key, { width: btnNode.offsetWidth, diff --git a/src/util.ts b/src/util.ts index c11039b7..e6ee069f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -16,8 +16,3 @@ export function stringify(obj: Record { const { container } = render(getTabs({ tabBarStyle: { background: 'red' } })); expect(container.querySelector('.rc-tabs-nav')).toHaveStyle({ background: 'red' }); }); - - it('key contains double quote should not crash', () => { - render() - }) });