feat(web-platform): release V0.8.3 常规界面优化
web-platform-release / Build and publish release (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (pull_request) Has been cancelled
web-platform-ci / Playwright E2E (pull_request) Has been cancelled
web-platform-release / Build and publish release (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (pull_request) Has been cancelled
web-platform-ci / Playwright E2E (pull_request) Has been cancelled
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import type { ComponentProps } from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import type { SimulationSnapshot } from '../../simulation/SimulationSession';
|
||||
import { WorkspaceToolsPanel } from './WorkspaceToolsPanel';
|
||||
|
||||
const snapshot = {
|
||||
actuators: [],
|
||||
joints: [],
|
||||
controller: { enabled: true },
|
||||
rlPolicy: { enabled: false },
|
||||
} as unknown as SimulationSnapshot;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
function props(): ComponentProps<typeof WorkspaceToolsPanel> {
|
||||
return {
|
||||
active: 'controls',
|
||||
snapshot,
|
||||
loading: false,
|
||||
ignoreJointLimits: false,
|
||||
jointAdvanced: false,
|
||||
angleUnit: 'rad',
|
||||
forceScale: 50,
|
||||
controllerPaths: [],
|
||||
controllerStatus: { enabled: true } as ComponentProps<
|
||||
typeof WorkspaceToolsPanel
|
||||
>['controllerStatus'],
|
||||
policyPaths: [],
|
||||
policyStatus: { enabled: false } as ComponentProps<typeof WorkspaceToolsPanel>['policyStatus'],
|
||||
onResetJoints: noop,
|
||||
onToggleJointLimits: noop,
|
||||
onToggleAdvanced: noop,
|
||||
onToggleAngleUnit: noop,
|
||||
onActuator: noop,
|
||||
onActuatorParameters: noop,
|
||||
onJoint: noop,
|
||||
onForceScale: noop,
|
||||
onSelectControllerPath: noop,
|
||||
onLoadControllerPath: noop,
|
||||
onImportController: noop,
|
||||
onToggleController: noop,
|
||||
onControllerCommand: noop,
|
||||
onRemoveController: noop,
|
||||
onSelectPolicyPath: noop,
|
||||
onLoadPolicyPath: noop,
|
||||
onImportPolicy: noop,
|
||||
onTogglePolicy: noop,
|
||||
onPolicyCommand: noop,
|
||||
onRemovePolicy: noop,
|
||||
onDataRecorderConfigure: noop,
|
||||
onDataRecordingStart: noop,
|
||||
onDataRecordingStop: noop,
|
||||
onDataRecordingClear: noop,
|
||||
onDataRecordingExport: noop,
|
||||
};
|
||||
}
|
||||
|
||||
describe('WorkspaceToolsPanel', () => {
|
||||
it('按实时控制到自动化流程排序,并默认折叠所有控制台组件', () => {
|
||||
render(<WorkspaceToolsPanel {...props()} />);
|
||||
|
||||
const sections = screen
|
||||
.getAllByRole('button')
|
||||
.filter((button) => button.hasAttribute('aria-expanded'));
|
||||
const expected = [
|
||||
['执行器实时控制', '控制'],
|
||||
['关节姿态调试', '调试'],
|
||||
['外力交互参数', '交互'],
|
||||
['Python 脚本控制', '控制', '运行'],
|
||||
['ONNX 策略运行', '推理', '停止'],
|
||||
['强化学习任务', '训练'],
|
||||
];
|
||||
|
||||
expect(sections).toHaveLength(expected.length);
|
||||
sections.forEach((section, index) => {
|
||||
expect(section).toHaveAttribute('aria-expanded', 'false');
|
||||
expected[index].forEach((label) => expect(section).toHaveTextContent(label));
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user