Skip to content

Commit

Permalink
Merge branch 'feature/support-capitalization2' of https://github.com/…
Browse files Browse the repository at this point in the history
…bedre7/lexical into feature/support-capitalization
  • Loading branch information
bedre7 committed Dec 13, 2024
2 parents 1e437b7 + 8469d94 commit b2dca35
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
selectCharacters,
toggleBold,
toggleBulletList,
toggleCapitalize,
toggleChecklist,
toggleInsertCodeBlock,
toggleItalic,
Expand Down Expand Up @@ -122,6 +123,10 @@ const additionalStylesTestCases = [
applyShortcut: (page) => toggleUppercase(page),
style: 'Uppercase',
},
{
applyShortcut: (page) => toggleCapitalize(page),
style: 'Capitalize',
},
{
applyShortcut: (page) => toggleStrikethrough(page),
style: 'Strikethrough',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
moveToLineEnd,
selectCharacters,
toggleBold,
toggleCapitalize,
toggleItalic,
toggleLowercase,
toggleUnderline,
Expand Down Expand Up @@ -441,6 +442,11 @@ test.describe.parallel('TextFormatting', () => {
className: 'PlaygroundEditorTheme__textUppercase',
format: 'uppercase',
},
{
applyCapitalization: toggleCapitalize,
className: 'PlaygroundEditorTheme__textCapitalize',
format: 'capitalize',
},
];

capitalizationFormats.forEach(({className, format, applyCapitalization}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ export async function toggleUppercase(page) {
await page.keyboard.up('Shift');
}

export async function toggleCapitalize(page) {
await keyDownCtrlOrMeta(page);
await page.keyboard.down('Shift');
await page.keyboard.press('3');
await keyUpCtrlOrMeta(page);
await page.keyboard.up('Shift');
}

export async function toggleStrikethrough(page) {
await keyDownCtrlOrMeta(page);
await page.keyboard.down('Shift');
Expand Down

0 comments on commit b2dca35

Please sign in to comment.