From e10ce07e3a19c0182bf878ae18821e09c3fe35ad Mon Sep 17 00:00:00 2001 From: gushuro Date: Thu, 8 Feb 2018 11:45:52 -0800 Subject: [PATCH] Emmet - Fixing bug in toggle comment with multi cursor (#42857) * Fixing issue with toggleComment on multiple nested cursors * Fix error when an edit is empty * reordering * adding a test for toggleComment on nested selections * Adding test for stylesheet files * Removing change that was making integration tests fail --- .../emmet/src/test/toggleComment.test.ts | 108 ++++++++++++++++++ extensions/emmet/src/toggleComment.ts | 23 +++- 2 files changed, 128 insertions(+), 3 deletions(-) diff --git a/extensions/emmet/src/test/toggleComment.test.ts b/extensions/emmet/src/test/toggleComment.test.ts index 46adb42a8d5..20d8a716d89 100644 --- a/extensions/emmet/src/test/toggleComment.test.ts +++ b/extensions/emmet/src/test/toggleComment.test.ts @@ -201,6 +201,52 @@ suite('Tests for Toggle Comment action from Emmet (HTML)', () => { }); }); }); + + test('toggle comment with multiple cursors selecting parent and child nodes', () => { + const expectedContents = ` +
+ + + + +
+ `; + return withRandomFileEditor(contents, 'html', (editor, doc) => { + editor.selections = [ + new Selection(3, 17, 3, 17), // cursor inside the inner span element + new Selection(4, 5, 4, 5), // two cursors: one inside opening tag + new Selection(4, 17, 4, 17), // and the second inside the inner span element + new Selection(7, 3, 7, 3), // two cursors: one inside open tag of