mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
fix: remove unnecessary type assertion (#37930)
* fix: remove uncessary type assertion * fix: remove as const
This commit is contained in:
parent
8fc5af0d87
commit
5325e19ba9
@ -180,10 +180,10 @@ describe('message.config', () => {
|
||||
}
|
||||
const [container1, removeContainer1] = createContainer();
|
||||
const [container2, removeContainer2] = createContainer();
|
||||
expect((container1 as HTMLDivElement).querySelector('.ant-message-notice')).toBeFalsy();
|
||||
expect((container2 as HTMLDivElement).querySelector('.ant-message-notice')).toBeFalsy();
|
||||
expect(container1.querySelector('.ant-message-notice')).toBeFalsy();
|
||||
expect(container2.querySelector('.ant-message-notice')).toBeFalsy();
|
||||
message.config({
|
||||
getContainer: () => container1 as HTMLDivElement,
|
||||
getContainer: () => container1,
|
||||
});
|
||||
const messageText1 = 'mounted in container1';
|
||||
|
||||
@ -191,20 +191,16 @@ describe('message.config', () => {
|
||||
message.info(messageText1);
|
||||
});
|
||||
|
||||
expect(
|
||||
(container1 as HTMLDivElement).querySelector('.ant-message-notice')?.textContent,
|
||||
).toEqual(messageText1);
|
||||
expect(container1.querySelector('.ant-message-notice')?.textContent).toEqual(messageText1);
|
||||
message.config({
|
||||
getContainer: () => container2 as HTMLDivElement,
|
||||
getContainer: () => container2,
|
||||
});
|
||||
const messageText2 = 'mounted in container2';
|
||||
|
||||
act(() => {
|
||||
message.info(messageText2);
|
||||
});
|
||||
expect(
|
||||
(container2 as HTMLDivElement).querySelector('.ant-message-notice')?.textContent,
|
||||
).toEqual(messageText2);
|
||||
expect(container2.querySelector('.ant-message-notice')?.textContent).toEqual(messageText2);
|
||||
if (typeof removeContainer1 === 'function') {
|
||||
removeContainer1();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user