|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-US"> |
| 3 | + <head> |
| 4 | + <link href="/assets/index.css" rel="stylesheet" type="text/css" /> |
| 5 | + <script crossorigin=" anonymous" src=" https://unpkg.com/@babel/[email protected]/babel.min.js" ></script> |
| 6 | + <script crossorigin=" anonymous" src=" https://unpkg.com/[email protected]/umd/react.production.min.js" ></script> |
| 7 | + <script crossorigin=" anonymous" src=" https://unpkg.com/[email protected]/umd/react-dom.production.min.js" ></script> |
| 8 | + <script crossorigin="anonymous" src="/test-harness.js"></script> |
| 9 | + <script crossorigin="anonymous" src="/test-page-object.js"></script> |
| 10 | + <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> |
| 11 | + <script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script> |
| 12 | + <style> |
| 13 | + #webchat .sendbox__toolbar-button .icon__send { |
| 14 | + --monochrome-image-masker__mask-image: url(url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 22 22'%3E%3Cpath fill='%23000' d='M4 18.5v-13L19.423 12zM5 17l11.85-5L5 7v3.885L9.846 12L5 13.116zm0 0V7z'/%3E%3C/svg%3E")); |
| 15 | + } |
| 16 | + #webchat .sendbox__toolbar-button .icon__attachment { |
| 17 | + --monochrome-image-masker__mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 22 22'%3E%3Cpath fill='%23000' d='M16.346 11.385V6.769h1v4.616zm-5.538 5.457q-.452-.269-.726-.734q-.274-.466-.274-1.031V6.769h1zM11.96 21q-2.271 0-3.846-1.595t-1.575-3.867v-8.73q0-1.587 1.09-2.697Q8.722 3 10.309 3t2.678 1.11t1.091 2.698V14h-1V6.789q-.006-1.166-.802-1.977T10.308 4q-1.163 0-1.966.821q-.804.821-.804 1.987v8.73q-.005 1.853 1.283 3.157Q10.11 20 11.961 20q.556 0 1.056-.124t.945-.372v1.11q-.468.2-.972.293q-.505.093-1.03.093m4.386-1v-2.616h-2.615v-1h2.615V13.77h1v2.615h2.616v1h-2.616V20z'/%3E%3C/svg%3E"); |
| 18 | + } |
| 19 | + </style> |
| 20 | + </head> |
| 21 | + <body> |
| 22 | + <main id="webchat"></main> |
| 23 | + <script type="text/babel"> |
| 24 | + run(async function () { |
| 25 | + const { |
| 26 | + React, |
| 27 | + ReactDOM: { render }, |
| 28 | + WebChat: { FluentThemeProvider, ReactWebChat } |
| 29 | + } = window; // Imports in UMD fashion. |
| 30 | + |
| 31 | + const { directLine, store } = testHelpers.createDirectLineEmulator(); |
| 32 | + |
| 33 | + const App = () => <ReactWebChat directLine={directLine} store={store} />; |
| 34 | + |
| 35 | + render( |
| 36 | + <FluentThemeProvider> |
| 37 | + <App /> |
| 38 | + </FluentThemeProvider>, |
| 39 | + document.getElementById('webchat') |
| 40 | + ); |
| 41 | + |
| 42 | + await pageConditions.uiConnected(); |
| 43 | + |
| 44 | + await directLine.emulateIncomingActivity( |
| 45 | + 'Eiusmod anim adipisicing cupidatat adipisicing officia sint qui consequat veniam id aute.' |
| 46 | + ); |
| 47 | + |
| 48 | + await pageConditions.numActivitiesShown(1); |
| 49 | + |
| 50 | + // THEN: Fluent theme should be loaded. |
| 51 | + const buildInfo = Object.fromEntries( |
| 52 | + document |
| 53 | + .querySelector('head > meta[name="botframework-webchat:fluent-theme"]') |
| 54 | + .content.split(';') |
| 55 | + .map(value => value.trim().split('=')) |
| 56 | + ); |
| 57 | + |
| 58 | + expect(buildInfo).toHaveProperty('build-tool', 'tsup'); |
| 59 | + expect(buildInfo).toHaveProperty('module-format', 'esmodules'); |
| 60 | + expect(buildInfo.version).toMatch(/^\d+\.\d+\.\d+($|-)/u); |
| 61 | + |
| 62 | + expect(window.WebChat.FluentThemeProvider).toBeTruthy(); |
| 63 | + |
| 64 | + // THEN: Should render the activity. |
| 65 | + await host.snapshot('local'); |
| 66 | + }); |
| 67 | + </script> |
| 68 | + </body> |
| 69 | +</html> |
0 commit comments