Browse Source

fix: remove unnecessary type assertion (#37930)

* fix: remove uncessary type assertion

* fix: remove as const
pull/37955/head
Zheeeng 2 years ago
committed by GitHub
parent
commit
5325e19ba9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      components/message/__tests__/config.test.ts

16
components/message/__tests__/config.test.ts

@ -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…
Cancel
Save