fix: z-index of antd (#3313)

* chore: auto update yarn.lock

* fix: z-index of antd

* test: add test

* test: add tests
This commit is contained in:
Zeke Zhang 2024-01-04 11:34:34 +08:00 committed by GitHub
parent fdbdbac3c6
commit ba67b7aede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1529 additions and 2 deletions

View File

@ -63,7 +63,9 @@ body a:active {
} }
/* fix https://nocobase.height.app/T-2838 */ /* fix https://nocobase.height.app/T-2838 */
/* fix https://nocobase.height.app/T-2797 */
/* fix https://nocobase.height.app/T-2868 */
/* antd 组件的层级有问题,有的弹窗是 1000 有的是 1200会导致弹窗被覆盖的问题。弹窗这里应该使用同一个值是比较合理的 */ /* antd 组件的层级有问题,有的弹窗是 1000 有的是 1200会导致弹窗被覆盖的问题。弹窗这里应该使用同一个值是比较合理的 */
.ant-modal-wrap, .ant-modal-mask { .ant-modal-wrap, .ant-modal-mask, .ant-drawer {
z-index: 1150 !important; z-index: 1150 !important;
} }

View File

@ -0,0 +1,33 @@
import { expect, test } from '@nocobase/test/e2e';
import { T2797, T2838 } from './templatesOfBug';
test.describe('z-index of dialog', () => {
// https://nocobase.height.app/T-2797
test('edit block title', async ({ page, mockPage }) => {
await mockPage(T2797).goto();
await page.getByLabel('action-Action.Link-Popup').click();
await page.getByLabel('action-Action-Popup drawer-').click();
await page.getByText('UsersConfigure fieldsSubmitConfigure actions').hover();
await page.getByRole('button', { name: 'designer-schema-settings-' }).hover();
await page.getByRole('menuitem', { name: 'Edit block title' }).click();
await expect(page.getByLabel('block-item-Input-users-Block')).toBeVisible();
await page.getByRole('button', { name: 'OK', exact: true }).click();
await expect(page.getByLabel('block-item-Input-users-Block')).not.toBeVisible();
});
// https://nocobase.height.app/T-2838
test('multilevel modal', async ({ page, mockPage, mockRecord }) => {
const nocoPage = await mockPage(T2838).waitForInit();
await mockRecord('general');
await nocoPage.goto();
await page.getByLabel('action-Action.Link-Edit').click();
await page.getByLabel('action-Action-Edit button 1-').click();
await page.getByLabel('action-Action-Edit button 2-').click();
await expect(page.getByLabel('block-item-CollectionField-')).toBeVisible();
await page.getByLabel('action-Action-Submit-submit-').click();
await expect(page.getByLabel('block-item-CollectionField-')).not.toBeVisible();
});
});

View File

@ -5,7 +5,6 @@ export const useStyles = genStyleHook('nb-action-drawer', (token) => {
return { return {
[componentCls]: { [componentCls]: {
zIndex: '1150 !important', // fix https://nocobase.height.app/T-2797
overflow: 'hidden', overflow: 'hidden',
'&.reset': { '&.reset': {
'&.nb-action-popup': { '&.nb-action-popup': {

View File

@ -237,6 +237,22 @@ test.describe('configure fields', () => {
await expect(page.getByRole('cell', { name: value, exact: true })).toBeVisible(); await expect(page.getByRole('cell', { name: value, exact: true })).toBeVisible();
} }
}); });
// https://nocobase.height.app/T-2868
test('sequence rules: z-index of configure drawer', async ({ page, mockCollections }) => {
const collectionManagerPage = new CollectionManagerPage(page);
await collectionManagerPage.goto();
const fieldsSettings = await collectionManagerPage.configureFields('users');
await fieldsSettings.addField('Sequence');
await page.getByRole('button', { name: 'plus Add rule' }).click();
await page.getByRole('button', { name: 'Configure', exact: true }).click();
await expect(page.getByLabel('block-item-InputNumber-Digits')).toBeVisible();
// 即使 drawer 被遮挡toBeVisible 也能通过,所以这里在通过点击按钮来关闭 drawer 进行测试
await page.getByRole('button', { name: 'Submit', exact: true }).first().click();
await expect(page.getByLabel('block-item-InputNumber-Digits')).not.toBeVisible();
});
}); });
test.describe('edit', () => { test.describe('edit', () => {