@@ -11,7 +11,7 @@ import { Selection } from 'vs/editor/common/core/selection';
11
11
import { Handler } from 'vs/editor/common/editorCommon' ;
12
12
import { ITextModel } from 'vs/editor/common/model' ;
13
13
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl' ;
14
- import { DeleteAllLeftAction , DeleteAllRightAction , DeleteDuplicateLinesAction , DeleteLinesAction , IndentLinesAction , InsertLineAfterAction , InsertLineBeforeAction , JoinLinesAction , LowerCaseAction , SnakeCaseAction , SortLinesAscendingAction , SortLinesDescendingAction , TitleCaseAction , TransposeAction , UpperCaseAction } from 'vs/editor/contrib/linesOperations/browser/linesOperations' ;
14
+ import { DeleteAllLeftAction , DeleteAllRightAction , DeleteDuplicateLinesAction , DeleteLinesAction , IndentLinesAction , InsertLineAfterAction , InsertLineBeforeAction , JoinLinesAction , KebabCaseAction , LowerCaseAction , SnakeCaseAction , SortLinesAscendingAction , SortLinesDescendingAction , TitleCaseAction , TransposeAction , UpperCaseAction } from 'vs/editor/contrib/linesOperations/browser/linesOperations' ;
15
15
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor' ;
16
16
import { createTextModel } from 'vs/editor/test/common/testTextModel' ;
17
17
@@ -814,6 +814,80 @@ suite('Editor Contrib - Line Operations', () => {
814
814
assertSelection ( editor , new Selection ( 2 , 2 , 2 , 2 ) ) ;
815
815
}
816
816
) ;
817
+
818
+ withTestCodeEditor (
819
+ [
820
+ 'hello world' ,
821
+ 'öçşğü' ,
822
+ 'parseHTMLString' ,
823
+ 'getElementById' ,
824
+ 'PascalCase' ,
825
+ 'öçşÖÇŞğüĞÜ' ,
826
+ 'audioConverter.convertM4AToMP3();' ,
827
+ 'Capital_Snake_Case' ,
828
+ 'parseHTML4String' ,
829
+ '_accessor: ServicesAccessor' ,
830
+ 'Kebab-Case' ,
831
+ ] , { } , ( editor ) => {
832
+ const model = editor . getModel ( ) ! ;
833
+ const kebabCaseAction = new KebabCaseAction ( ) ;
834
+
835
+ editor . setSelection ( new Selection ( 1 , 1 , 1 , 12 ) ) ;
836
+ executeAction ( kebabCaseAction , editor ) ;
837
+ assert . strictEqual ( model . getLineContent ( 1 ) , 'hello world' ) ;
838
+ assertSelection ( editor , new Selection ( 1 , 1 , 1 , 12 ) ) ;
839
+
840
+ editor . setSelection ( new Selection ( 2 , 1 , 2 , 6 ) ) ;
841
+ executeAction ( kebabCaseAction , editor ) ;
842
+ assert . strictEqual ( model . getLineContent ( 2 ) , 'öçşğü' ) ;
843
+ assertSelection ( editor , new Selection ( 2 , 1 , 2 , 6 ) ) ;
844
+
845
+ editor . setSelection ( new Selection ( 3 , 1 , 3 , 16 ) ) ;
846
+ executeAction ( kebabCaseAction , editor ) ;
847
+ assert . strictEqual ( model . getLineContent ( 3 ) , 'parse-html-string' ) ;
848
+ assertSelection ( editor , new Selection ( 3 , 1 , 3 , 18 ) ) ;
849
+
850
+ editor . setSelection ( new Selection ( 4 , 1 , 4 , 15 ) ) ;
851
+ executeAction ( kebabCaseAction , editor ) ;
852
+ assert . strictEqual ( model . getLineContent ( 4 ) , 'get-element-by-id' ) ;
853
+ assertSelection ( editor , new Selection ( 4 , 1 , 4 , 18 ) ) ;
854
+
855
+ editor . setSelection ( new Selection ( 5 , 1 , 5 , 11 ) ) ;
856
+ executeAction ( kebabCaseAction , editor ) ;
857
+ assert . strictEqual ( model . getLineContent ( 5 ) , 'pascal-case' ) ;
858
+ assertSelection ( editor , new Selection ( 5 , 1 , 5 , 12 ) ) ;
859
+
860
+ editor . setSelection ( new Selection ( 6 , 1 , 6 , 11 ) ) ;
861
+ executeAction ( kebabCaseAction , editor ) ;
862
+ assert . strictEqual ( model . getLineContent ( 6 ) , 'öçş-öç-şğü-ğü' ) ;
863
+ assertSelection ( editor , new Selection ( 6 , 1 , 6 , 14 ) ) ;
864
+
865
+ editor . setSelection ( new Selection ( 7 , 1 , 7 , 34 ) ) ;
866
+ executeAction ( kebabCaseAction , editor ) ;
867
+ assert . strictEqual ( model . getLineContent ( 7 ) , 'audio-converter.convert-m4a-to-mp3();' ) ;
868
+ assertSelection ( editor , new Selection ( 7 , 1 , 7 , 38 ) ) ;
869
+
870
+ editor . setSelection ( new Selection ( 8 , 1 , 8 , 19 ) ) ;
871
+ executeAction ( kebabCaseAction , editor ) ;
872
+ assert . strictEqual ( model . getLineContent ( 8 ) , 'capital-snake-case' ) ;
873
+ assertSelection ( editor , new Selection ( 8 , 1 , 8 , 19 ) ) ;
874
+
875
+ editor . setSelection ( new Selection ( 9 , 1 , 9 , 17 ) ) ;
876
+ executeAction ( kebabCaseAction , editor ) ;
877
+ assert . strictEqual ( model . getLineContent ( 9 ) , 'parse-html4-string' ) ;
878
+ assertSelection ( editor , new Selection ( 9 , 1 , 9 , 19 ) ) ;
879
+
880
+ editor . setSelection ( new Selection ( 10 , 1 , 10 , 28 ) ) ;
881
+ executeAction ( kebabCaseAction , editor ) ;
882
+ assert . strictEqual ( model . getLineContent ( 10 ) , '_accessor: services-accessor' ) ;
883
+ assertSelection ( editor , new Selection ( 10 , 1 , 10 , 29 ) ) ;
884
+
885
+ editor . setSelection ( new Selection ( 11 , 1 , 11 , 11 ) ) ;
886
+ executeAction ( kebabCaseAction , editor ) ;
887
+ assert . strictEqual ( model . getLineContent ( 11 ) , 'kebab-case' ) ;
888
+ assertSelection ( editor , new Selection ( 11 , 1 , 11 , 11 ) ) ;
889
+ }
890
+ ) ;
817
891
} ) ;
818
892
819
893
suite ( 'DeleteAllRightAction' , ( ) => {
0 commit comments