Skip to content

Commit

Permalink
Add tests for new comment types
Browse files Browse the repository at this point in the history
  • Loading branch information
benjervis committed Mar 6, 2024
1 parent 000ef3b commit 19eec19
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion cypress/e2e/keymaps.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ describe('Keymaps', () => {
>
Text
</button>
`);
`);

moveBy(0, 2);

Expand All @@ -429,6 +429,76 @@ describe('Keymaps', () => {
</button>
`);
});

it('block - expression slot outside tags', () => {
loadPlayroom(`
{testFn('test')}
<div>First line</div>
<div>Second line</div>
<div>Third line</div>
`);

executeToggleCommentCommand();

assertCodePaneContains(dedent`
{/* {testFn('test')} */}
<div>First line</div>
<div>Second line</div>
<div>Third line</div>
`);
});

it('line - inside multi-line expression slot outside tags', () => {
loadPlayroom(`
{
testFn('test')
}
<div>First line</div>
<div>Second line</div>
<div>Third line</div>
`);

moveBy(0, 1);

executeToggleCommentCommand();

assertCodePaneContains(dedent`
{
// testFn('test')
}
<div>First line</div>
<div>Second line</div>
<div>Third line</div>
`);
});

it('line - full line expression slot inside tags', () => {
loadPlayroom(`
<div
prop1="prop1"
{...props}
>
First line
</div>
<div>Second line</div>
<div>Third line</div>
`);

moveBy(0, 2);

executeToggleCommentCommand();

assertCodePaneContains(dedent`
<div
prop1="prop1"
// {...props}
>
First line
</div>
<div>Second line</div>
<div>Third line</div>
`);
});
});

describe('should wrap a single line selection in a comment', () => {
Expand Down

0 comments on commit 19eec19

Please sign in to comment.