diff --git a/CHANGELOG.md b/CHANGELOG.md index 31cb8302c0..7696d5e2b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/ - Added `CopilotMessageHeader` component for displaying bot information in the "copilot" variant, in PR [#5258](https://github.com/microsoft/BotFramework-WebChat/pull/5258), by [@OEvgeny](https://github.com/OEvgeny) - Updated Fluent theme styling to improve accessibility and visual consistency, in PR [#5258](https://github.com/microsoft/BotFramework-WebChat/pull/5258), by [@OEvgeny](https://github.com/OEvgeny) - Fixed header font in copilot variant, in PR [#5261](https://github.com/microsoft/BotFramework-WebChat/pull/5261), by [@OEvgeny](https://github.com/OEvgeny) -- Added "Copy" button to bot messages in Fluent UI if it contains keyword `AllowCopy`, in PR [#5259](https://github.com/microsoft/BotFramework-WebChat/pull/5259), [#5262](https://github.com/microsoft/BotFramework-WebChat/pull/5262), and [#5285](https://github.com/microsoft/BotFramework-WebCHat/pull/5285), by [@compulim](https://github.com/compulim) +- Added "Copy" button to bot messages in Fluent UI if it contains keyword `AllowCopy`, in PR [#5259](https://github.com/microsoft/BotFramework-WebChat/pull/5259), [#5262](https://github.com/microsoft/BotFramework-WebChat/pull/5262), and [#5285](https://github.com/microsoft/BotFramework-WebChat/pull/5285), by [@compulim](https://github.com/compulim) - Resolves [#4876](https://github.com/microsoft/BotFramework-WebChat/issues/4876) and [#4939](https://github.com/microsoft/BotFramework-WebChat/issues/4939). Added support of informative message in livestreaming, by [@compulim](https://github.com/compulim), in PR [#5265](https://github.com/microsoft/BotFramework-WebChat/pull/5265) - Introduced centralized announcements approach via the new `usePushToLiveRegion` hook, in PR [#5251](https://github.com/microsoft/BotFramework-WebChat/pull/5251), by [@OEvgeny](https://github.com/OEvgeny) - Added keyboard shortcut for the "New Messages" button, in PR [#5251](https://github.com/microsoft/BotFramework-WebChat/pull/5251), by [@OEvgeny](https://github.com/OEvgeny) @@ -91,6 +91,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/ - Improved view code dialog UI in Fluent theme with better styling and accessibility, in PR [#5337](https://github.com/microsoft/BotFramework-WebChat/pull/5337), by [@OEvgeny](https://github.com/OEvgeny) - Switched math block syntax from `$$` to Tex-style `\[ \]` and `\( \)` delimiters with improved rendering and error handling, in PR [#5353](https://github.com/microsoft/BotFramework-WebChat/pull/5353), by [@OEvgeny](https://github.com/OEvgeny) - Improved avatar display and grouping behavior by fixing rendering issues and activity sender identification, in PR [#5346](https://github.com/microsoft/BotFramework-WebChat/pull/5346), by [@OEvgeny](https://github.com/OEvgeny) +- Activity "copy" button will use `outerHTML` and `textContent` for clipboard content, in PR [#5378](https://github.com/microsoft/BotFramework-WebChat/pull/5378), by [@compulim](https://github.com/compuilm) ### Fixed diff --git a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-1-snap.png b/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-1-snap.png deleted file mode 100644 index 572ed48e3c..0000000000 Binary files a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-1-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-2-snap.png b/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-2-snap.png deleted file mode 100644 index f535c49191..0000000000 Binary files a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-2-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-3-snap.png b/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-3-snap.png deleted file mode 100644 index b9eb49a501..0000000000 Binary files a/__tests__/__image_snapshots__/html/copy-button-js-copy-button-should-work-3-snap.png and /dev/null differ diff --git a/__tests__/html/copyButton.denied.js b/__tests__/html/copyButton.denied.js deleted file mode 100644 index e62a0ae418..0000000000 --- a/__tests__/html/copyButton.denied.js +++ /dev/null @@ -1,3 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -test('copy button with denied permission should be disabled', () => runHTML('copyButton.denied')); diff --git a/__tests__/html/copyButton.disabled.js b/__tests__/html/copyButton.disabled.js deleted file mode 100644 index 4381b312c1..0000000000 --- a/__tests__/html/copyButton.disabled.js +++ /dev/null @@ -1,3 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -test('copy button should be able to disable', () => runHTML('copyButton.disabled')); diff --git a/__tests__/html/copyButton.hideAndShow.js b/__tests__/html/copyButton.hideAndShow.js deleted file mode 100644 index dfdde9572d..0000000000 --- a/__tests__/html/copyButton.hideAndShow.js +++ /dev/null @@ -1,3 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -test('copy button should not show as copied on hide/show', () => runHTML('copyButton.hideAndShow')); diff --git a/__tests__/html/copyButton.js b/__tests__/html/copyButton.js deleted file mode 100644 index b0e1a879eb..0000000000 --- a/__tests__/html/copyButton.js +++ /dev/null @@ -1,3 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -test('copy button should work', () => runHTML('copyButton')); diff --git a/__tests__/html/copyButton.layout.js b/__tests__/html/copyButton.layout.js deleted file mode 100644 index bdf462a54e..0000000000 --- a/__tests__/html/copyButton.layout.js +++ /dev/null @@ -1,12 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -describe.each([ - ['light', 'white label'], - ['dark', 'fluent'], - ['dark', 'copilot'], - ['light', 'fluent'], - ['light', 'copilot'] -])('with %s theme and %s variant', (theme, variant) => - test('copy button should layout properly', () => - runHTML(`copyButton.layout?${new URLSearchParams({ theme, variant }).toString()}`)) -); diff --git a/__tests__/html/copyButton.denied.html b/__tests__/html2/copyButton/behavior.denied.html similarity index 97% rename from __tests__/html/copyButton.denied.html rename to __tests__/html2/copyButton/behavior.denied.html index 770a09c9cb..946dd70f2f 100644 --- a/__tests__/html/copyButton.denied.html +++ b/__tests__/html2/copyButton/behavior.denied.html @@ -59,13 +59,13 @@ expect(copyButton.getAttribute('aria-disabled')).toBe('true'); // THEN: Should match screenshot. - await host.snapshot(); + await host.snapshot('local'); // WHEN: Clicks the "Copy" button. await host.click(copyButton); // THEN: The copy button should not change to "Copied". - await host.snapshot(); + await host.snapshot('local'); });
diff --git a/__tests__/__image_snapshots__/html/copy-button-denied-js-copy-button-with-denied-permission-should-be-disabled-1-snap.png b/__tests__/html2/copyButton/behavior.denied.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-denied-js-copy-button-with-denied-permission-should-be-disabled-1-snap.png rename to __tests__/html2/copyButton/behavior.denied.html.snap-1.png diff --git a/__tests__/__image_snapshots__/html/copy-button-denied-js-copy-button-with-denied-permission-should-be-disabled-2-snap.png b/__tests__/html2/copyButton/behavior.denied.html.snap-2.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-denied-js-copy-button-with-denied-permission-should-be-disabled-2-snap.png rename to __tests__/html2/copyButton/behavior.denied.html.snap-2.png diff --git a/__tests__/html/copyButton.disabled.html b/__tests__/html2/copyButton/behavior.disabled.html similarity index 97% rename from __tests__/html/copyButton.disabled.html rename to __tests__/html2/copyButton/behavior.disabled.html index 1956fbdb82..4ef5e95b74 100644 --- a/__tests__/html/copyButton.disabled.html +++ b/__tests__/html2/copyButton/behavior.disabled.html @@ -59,13 +59,13 @@ expect(copyButton.getAttribute('aria-disabled')).toBe('true'); // THEN: Should match screenshot. - await host.snapshot(); + await host.snapshot('local'); // WHEN: Clicks the "Copy" button. await host.click(copyButton); // THEN: The copy button should not change to "Copied". - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/copy-button-disabled-js-copy-button-should-be-able-to-disable-1-snap.png b/__tests__/html2/copyButton/behavior.disabled.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-disabled-js-copy-button-should-be-able-to-disable-1-snap.png rename to __tests__/html2/copyButton/behavior.disabled.html.snap-1.png diff --git a/__tests__/__image_snapshots__/html/copy-button-disabled-js-copy-button-should-be-able-to-disable-2-snap.png b/__tests__/html2/copyButton/behavior.disabled.html.snap-2.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-disabled-js-copy-button-should-be-able-to-disable-2-snap.png rename to __tests__/html2/copyButton/behavior.disabled.html.snap-2.png diff --git a/__tests__/html/copyButton.hideAndShow.html b/__tests__/html2/copyButton/behavior.hideAndShow.html similarity index 96% rename from __tests__/html/copyButton.hideAndShow.html rename to __tests__/html2/copyButton/behavior.hideAndShow.html index f66d3623f5..e23d33596c 100644 --- a/__tests__/html/copyButton.hideAndShow.html +++ b/__tests__/html2/copyButton/behavior.hideAndShow.html @@ -63,13 +63,13 @@ await host.click(document.querySelector(`[data-testid="${WebChat.testIds.copyButton}"]`)); // THEN: The "Copy" button should say "Copied". - await host.snapshot(); + await host.snapshot('local'); // WHEN: After 1 second. await testHelpers.sleep(1_000); // THEN: The "Copy" button should back to normal. - await host.snapshot(); + await host.snapshot('local'); // WHEN: Hiding Web Chat and showing it back. document.getElementById('webchat').style.display = 'none'; @@ -77,7 +77,7 @@ document.getElementById('webchat').style.display = ''; // THEN: The "Copy" button should kept at normal. - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-1-snap.png b/__tests__/html2/copyButton/behavior.hideAndShow.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-1-snap.png rename to __tests__/html2/copyButton/behavior.hideAndShow.html.snap-1.png diff --git a/__tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-2-snap.png b/__tests__/html2/copyButton/behavior.hideAndShow.html.snap-2.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-2-snap.png rename to __tests__/html2/copyButton/behavior.hideAndShow.html.snap-2.png diff --git a/__tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-3-snap.png b/__tests__/html2/copyButton/behavior.hideAndShow.html.snap-3.png similarity index 100% rename from __tests__/__image_snapshots__/html/copy-button-hide-and-show-js-copy-button-should-not-show-as-copied-on-hide-show-3-snap.png rename to __tests__/html2/copyButton/behavior.hideAndShow.html.snap-3.png diff --git a/__tests__/html/copyButton.html b/__tests__/html2/copyButton/behavior.html similarity index 84% rename from __tests__/html/copyButton.html rename to __tests__/html2/copyButton/behavior.html index 14edc9db93..d75ef9e43d 100644 --- a/__tests__/html/copyButton.html +++ b/__tests__/html2/copyButton/behavior.html @@ -73,7 +73,7 @@ type: 'https://schema.org/Message' } ], - text: 'Mollit *aute* **aute** dolor ea ex magna incididunt nostrud sit nisi.', + text: 'Mollit *aute* **aute** dolor ea ex magna incididunt nostrud sit nisi. ', type: 'message' }); @@ -88,13 +88,13 @@ const copyButton = document.querySelector(`[data-testid="${WebChat.testIds.copyButton}"]`); expect(document.activeElement).toBe(copyButton); - await host.snapshot(); + await host.snapshot('local'); // WHEN: Press ENTER on the "Copy" button. await host.sendKeys('ENTER'); // THEN: The copy button should change to "Copied". - await host.snapshot(); + await host.snapshot('local'); // WHEN: Paste into plain text and rich text text box. await host.click(document.querySelector('[data-testid="plain-text-box"]')); @@ -109,7 +109,7 @@ await testHelpers.sleep(500); // THEN: Plain text box should contains plain text, while rich text box should contains rich text. - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/html2/copyButton/behavior.html.snap-1.png b/__tests__/html2/copyButton/behavior.html.snap-1.png new file mode 100644 index 0000000000..90cacf6298 Binary files /dev/null and b/__tests__/html2/copyButton/behavior.html.snap-1.png differ diff --git a/__tests__/html2/copyButton/behavior.html.snap-2.png b/__tests__/html2/copyButton/behavior.html.snap-2.png new file mode 100644 index 0000000000..07e6a7c7cf Binary files /dev/null and b/__tests__/html2/copyButton/behavior.html.snap-2.png differ diff --git a/__tests__/html2/copyButton/behavior.html.snap-3.png b/__tests__/html2/copyButton/behavior.html.snap-3.png new file mode 100644 index 0000000000..d6e1c2174c Binary files /dev/null and b/__tests__/html2/copyButton/behavior.html.snap-3.png differ diff --git a/__tests__/html2/copyButton/layout.copilot.dark.html b/__tests__/html2/copyButton/layout.copilot.dark.html new file mode 100644 index 0000000000..54d46a168d --- /dev/null +++ b/__tests__/html2/copyButton/layout.copilot.dark.html @@ -0,0 +1,9 @@ + + +
+ + +
+