|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-US"> |
| 3 | + <head> |
| 4 | + <link href="/assets/index.css" rel="stylesheet" type="text/css" /> |
| 5 | + </head> |
| 6 | + <body> |
| 7 | + <main id="webchat"></main> |
| 8 | + <script type="importmap"> |
| 9 | + { |
| 10 | + "imports": { |
| 11 | + "botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js", |
| 12 | + "jest-mock": "https://esm.sh/jest-mock", |
| 13 | + "react": "/__dist__/packages/bundle/static/react.js", |
| 14 | + "react-dom": "/__dist__/packages/bundle/static/react-dom.js" |
| 15 | + } |
| 16 | + } |
| 17 | + </script> |
| 18 | + <script type="module"> |
| 19 | + import { fn, spyOn } from 'jest-mock'; |
| 20 | + |
| 21 | + spyOn(console, 'warn'); |
| 22 | + </script> |
| 23 | + <script type="module"> |
| 24 | + import '/test-harness.mjs'; |
| 25 | + import '/test-page-object.mjs'; |
| 26 | + |
| 27 | + import { Components, createDirectLine, createStoreWithOptions, renderWebChat } from 'botframework-webchat'; |
| 28 | + import { version } from 'react'; |
| 29 | + |
| 30 | + run(async function () { |
| 31 | + expect(console.warn).toHaveBeenCalledTimes(0); |
| 32 | + |
| 33 | + // WHEN: Touching "Components.BasicWebChat". |
| 34 | + expect(Components.BasicWebChat).not.toBeUndefined(); |
| 35 | + |
| 36 | + // THEN: Should show deprecation note. |
| 37 | + expect(console.warn).toHaveBeenCalledTimes(1); |
| 38 | + expect(console.warn).toHaveBeenLastCalledWith( |
| 39 | + "botframework-webchat: `import { Components } from 'botframework-webchat'` has been deprecated, use `import { %s } from 'botframework-webchat/component'` instead.", |
| 40 | + 'BasicWebChat' |
| 41 | + ); |
| 42 | + |
| 43 | + // WHEN: Touching "Components.BasicTranscript". |
| 44 | + expect(Components.BasicWebChat).not.toBeUndefined(); |
| 45 | + |
| 46 | + // THEN: Should not show deprecation note again. |
| 47 | + expect(console.warn).toHaveBeenCalledTimes(1); |
| 48 | + }); |
| 49 | + </script> |
| 50 | + </body> |
| 51 | +</html> |
0 commit comments