@@ -527,21 +527,38 @@ test('Fix properties sorting', () => {
527527 a.b({/*2*/})./*3*/
528528 }
529529
530- declare function MyComponent(props: { b?; c? } & { a? }): JSX.Element
531- <MyComponent /*4*/ />;
532-
533530 let a: { b:{}, a() } = {
534531 /*5*/
535532 }
533+
534+ declare function MyComponent(props: { b?; c? } & { a? }): JSX.Element
535+ <MyComponent /*4*/ />;
536+ <MyComponent
537+ c=''
538+ /*41*/
539+ />;
540+ <MyComponent
541+ test2=''
542+ /*41*/
543+ test=''
544+ />;
545+ <MyComponent /*42*/
546+ test2=''
547+ />;
536548 ` )
537549 const assertSorted = ( marker : number , expected : string [ ] ) => {
538550 const { entriesSorted } = getCompletionsAtPosition ( currentTestingContext . markers [ marker ] ! ) !
539- expect ( entriesSorted . map ( x => x . name ) ) . toEqual ( expected )
551+ expect (
552+ entriesSorted . map ( x => x . name ) ,
553+ `${ marker } ` ,
554+ ) . toEqual ( expected )
540555 }
541556 assertSorted ( 1 , [ 'c' , 'b' ] )
542557 assertSorted ( 2 , [ 'c' , 'b' ] )
543558 assertSorted ( 3 , [ 'c' , 'b' ] )
544559 assertSorted ( 4 , [ 'b' , 'c' , 'a' ] )
560+ assertSorted ( 41 , [ 'b' , 'c' , 'a' ] )
561+ assertSorted ( 42 , [ 'b' , 'c' , 'a' ] )
545562 assertSorted ( 5 , [ 'b' , 'b' , 'a' , 'a' ] )
546563 settingsOverride . fixSuggestionsSorting = false
547564} )
@@ -570,11 +587,36 @@ testTs5('Change to function kind', () => {
570587} )
571588
572589testTs5 ( 'Filter JSX Components' , ( ) => {
573- const tester = fourslashLikeTester ( /* ts */ `
574- const a = () => {}
575- a/*1*/
590+ overrideSettings ( {
591+ // improveJsxCompletions: false,
592+ 'experiments.excludeNonJsxCompletions' : true ,
593+ } )
594+ const tester = fourslashLikeTester ( /* tsx */ `
595+ const someFunction = () => {}
596+ declare namespace JSX {
597+ interface IntrinsicElements {
598+ superSpan: any;
599+ }
600+ }
601+ // return < // TODO
602+ return <s/*1*/
603+ ` )
604+ tester . completion ( 1 , {
605+ excludes : [ 'someFunction' ] ,
606+ includes : {
607+ names : [ 'superSpan' ] ,
608+ } ,
609+ } )
610+ // https://github.com/zardoy/typescript-vscode-plugins/issues/205
611+ const tester2 = fourslashLikeTester ( /* tsx */ `
612+ const Img = ({ alt }) => {}
613+ <Img\n\t/*1*/\n/>
576614 ` )
577- // TODO
615+ tester2 . completion ( 1 , {
616+ includes : {
617+ names : [ 'alt' ] ,
618+ } ,
619+ } )
578620} )
579621
580622test ( 'Omit<..., ""> suggestions' , ( ) => {
0 commit comments