diff --git a/novalon-manage-web/src/__tests__/components/MenuItem.test.ts b/novalon-manage-web/src/__tests__/components/MenuItem.test.ts
new file mode 100644
index 0000000..92bd3eb
--- /dev/null
+++ b/novalon-manage-web/src/__tests__/components/MenuItem.test.ts
@@ -0,0 +1,72 @@
+import { describe, it, expect } from 'vitest'
+import { mount } from '@vue/test-utils'
+import MenuItem from '@/components/MenuItem.vue'
+
+describe('MenuItem 组件', () => {
+ it('应该正确接收菜单项 props', () => {
+ const menu = {
+ id: 1,
+ name: '仪表盘',
+ path: '/dashboard',
+ icon: 'Odometer',
+ sort: 1
+ }
+
+ const wrapper = mount(MenuItem, {
+ props: { menu },
+ global: {
+ stubs: {
+ 'el-menu-item': {
+ template: '
'
+ },
+ 'el-sub-menu': {
+ template: '
'
+ },
+ 'el-icon': {
+ template: '
'
+ }
+ }
+ }
+ })
+
+ expect(wrapper.props('menu')).toEqual(menu)
+ })
+
+ it('应该正确处理有子菜单的菜单项', () => {
+ const menu = {
+ id: 2,
+ name: '系统管理',
+ path: '/system',
+ icon: 'Setting',
+ sort: 2,
+ children: [
+ {
+ id: 3,
+ name: '用户管理',
+ path: '/users',
+ sort: 1
+ }
+ ]
+ }
+
+ const wrapper = mount(MenuItem, {
+ props: { menu },
+ global: {
+ stubs: {
+ 'el-menu-item': {
+ template: '
'
+ },
+ 'el-sub-menu': {
+ template: '
'
+ },
+ 'el-icon': {
+ template: '
'
+ }
+ }
+ }
+ })
+
+ expect(wrapper.props('menu')).toEqual(menu)
+ expect(wrapper.props('menu').children).toHaveLength(1)
+ })
+})
diff --git a/novalon-manage-web/src/components/MenuItem.vue b/novalon-manage-web/src/components/MenuItem.vue
new file mode 100644
index 0000000..5f79386
--- /dev/null
+++ b/novalon-manage-web/src/components/MenuItem.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ {{ menu.name }}
+
+
+
+
+
+
+
+
+ {{ menu.name }}
+
+
+
+