Skip to content

Commit

Permalink
Add test case for context menu ability to paste text with custom style
Browse files Browse the repository at this point in the history
  • Loading branch information
citruscai committed Oct 30, 2024
1 parent 7ac8856 commit ad4f0db
Showing 1 changed file with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
*/

import {selectAll} from '../../../keyboardShortcuts/index.mjs';
import {
assertHTML,
click,
Expand Down Expand Up @@ -52,4 +52,44 @@ test.describe('ContextMenuCopyAndPaste', () => {
`,
);
});
test('Rich text Copy and Paste', async ({page, isRichText}) => {
test.skip(isRichText);
await focusEditor(page);
await page.keyboard.type('MLH Fellowship');
await page.keyboard.press('Enter');
await page.keyboard.press('Enter');
await page.keyboard.type('Fall 2024');

await selectAll();
await click(page, '.font-increment');
await click(page, '.lock');

await page.pause();
await doubleClick(page, 'div[contenteditable="false"] span');
await page.pause();
await click(page, 'div[contenteditable="false"] span', {button: 'right'});
await click(page, '#typeahead-menu [role="option"] :text("Copy")');

await click(page, '.unlock');
await focusEditor(page);

await pasteFromClipboard(page);

await assertHTML(
page,
html`
<p class="PlaygroundEditorTheme__paragraph" dir="ltr">
<span style="font-size: 17px; white-space: pre-wrap;">
MLH Fellowship
</span>
</p>
<p class="PlaygroundEditorTheme__paragraph">
<br />
</p>
<p class="PlaygroundEditorTheme__paragraph" dir="ltr">
<span style="font-size: 17px; white-space: pre-wrap;">Fall 2024</span>
</p>
`,
);
});
});

0 comments on commit ad4f0db

Please sign in to comment.