diff --git a/components/sender/__tests__/__snapshots__/index.test.tsx.snap b/components/sender/__tests__/__snapshots__/index.test.tsx.snap index 01890f12..c52d554c 100644 --- a/components/sender/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/sender/__tests__/__snapshots__/index.test.tsx.snap @@ -1,5 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Sender Component allowSpeech 1`] = `null`; + +exports[`Sender Component allowSpeech 2`] = `null`; + exports[`Sender Component loading state 1`] = `
{ const { container } = render(); expect(container.querySelector('textarea')).toHaveAttribute('readonly'); }); + + it('allowSpeech', () => { + const { container } = render(); + expect(container.querySelector('.ant-sender-action-list-presets')).toMatchSnapshot(); + + // 不支持语音时不显示语音按钮 + const mockSpeechRecognition = (window as any).SpeechRecognition; + delete (window as any).SpeechRecognition; + delete (window as any).webkitSpeechRecognition; + + const { container: noSpeechContainer } = render(); + expect(noSpeechContainer.querySelector('.ant-sender-action-list-presets')).toMatchSnapshot(); + + // 恢复 mock + (window as any).SpeechRecognition = mockSpeechRecognition; + }); });