This commit is contained in:
2026-08-12 17:29:35 +08:00
parent 16c5ed6301
commit d2a246b122
25 changed files with 238 additions and 69 deletions
@@ -1,4 +1,6 @@
import ElementPlus from 'element-plus'
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { createPinia, setActivePinia } from 'pinia'
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -11,6 +13,8 @@ import { useAccessPreviewStore } from '@/core/access/accessPreview'
import { useAuthStore } from '@/core/auth/auth'
import InternalUsersView from './InternalUsersView.vue'
const internalUsersSource = readFileSync(resolve(process.cwd(), 'src/modules/iam/pages/InternalUsersView.vue'), 'utf8')
vi.mock('@/modules/iam/api/platformIam', () => ({
listPlatformManagedUsers: vi.fn(),
getPlatformUserOptions: vi.fn(),
@@ -70,6 +74,13 @@ enableAutoUnmount(afterEach)
afterAll(() => vi.unstubAllGlobals())
describe('InternalUsersView platform internal user management', () => {
it('uses the prototype-sized centered editor with a scrollable body and mobile single column', () => {
expect(internalUsersSource).toContain('width="min(650px, calc(100vw - 28px))"')
expect(internalUsersSource).toContain(':global(.internal-user-editor-dialog .el-dialog__body) { min-height: 0; overflow-y: auto; }')
expect(internalUsersSource).toContain(':global(.internal-user-editor-dialog .el-dialog__footer) { flex: 0 0 auto; }')
expect(internalUsersSource).toContain('@media (max-width: 720px)')
expect(internalUsersSource).toContain('.form-grid.two-cols { grid-template-columns: 1fr; }')
})
beforeEach(() => {
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
document.body.innerHTML = ''