@@ -623,6 +623,124 @@ Allowed Values:
623
623
* \`bird\`
624
624
* \`fish\`: Special fish
625
625
626
+ Source: [${ SCHEMA_ID } ](file:///${ SCHEMA_ID } )`
627
+ ) ;
628
+ } ) ;
629
+
630
+ it ( 'Hover displays unique enum values with prroper description (1st case)' , async ( ) => {
631
+ schemaProvider . addSchema ( SCHEMA_ID , {
632
+ type : 'object' ,
633
+ properties : {
634
+ animal : {
635
+ description : 'should return this description' ,
636
+ anyOf : [
637
+ {
638
+ enum : [ 'cat' , 'dog' , 'fish' ] ,
639
+ enumDescriptions : [ '1st cat' , '1st dog' , '1st fish' ] , // should use this description for "fish"
640
+ } ,
641
+ {
642
+ enum : [ 'bird' , 'fish' , 'ant' ] ,
643
+ } ,
644
+ ] ,
645
+ } ,
646
+ } ,
647
+ } ) ;
648
+ const content = 'animal:\n fis|n|' ; // len: 13, pos: 12
649
+ const result = await parseSetup ( content ) ;
650
+
651
+ assert . strictEqual ( MarkupContent . is ( result . contents ) , true ) ;
652
+ assert . strictEqual ( ( result . contents as MarkupContent ) . kind , 'markdown' ) ;
653
+ assert . strictEqual (
654
+ ( result . contents as MarkupContent ) . value ,
655
+ `should return this description
656
+
657
+ Allowed Values:
658
+
659
+ * \`ant\`
660
+ * \`cat\`: 1st cat
661
+ * \`dog\`: 1st dog
662
+ * \`fish\`: 1st fish
663
+ * \`bird\`
664
+
665
+ Source: [${ SCHEMA_ID } ](file:///${ SCHEMA_ID } )`
666
+ ) ;
667
+ } ) ;
668
+
669
+ it ( 'Hover displays unique enum values with prroper description (2nd case)' , async ( ) => {
670
+ schemaProvider . addSchema ( SCHEMA_ID , {
671
+ type : 'object' ,
672
+ properties : {
673
+ animal : {
674
+ description : 'should return this description' ,
675
+ anyOf : [
676
+ {
677
+ enum : [ 'cat' , 'dog' , 'fish' ] ,
678
+ } ,
679
+ {
680
+ enum : [ 'bird' , 'fish' , 'ant' ] ,
681
+ enumDescriptions : [ '2nd bird' , '2nd fish' , '2nd ant' ] , // should use this description for "fish"
682
+ } ,
683
+ ] ,
684
+ } ,
685
+ } ,
686
+ } ) ;
687
+ const content = 'animal:\n fis|n|' ; // len: 13, pos: 12
688
+ const result = await parseSetup ( content ) ;
689
+
690
+ assert . strictEqual ( MarkupContent . is ( result . contents ) , true ) ;
691
+ assert . strictEqual ( ( result . contents as MarkupContent ) . kind , 'markdown' ) ;
692
+ assert . strictEqual (
693
+ ( result . contents as MarkupContent ) . value ,
694
+ `should return this description
695
+
696
+ Allowed Values:
697
+
698
+ * \`ant\`: 2nd ant
699
+ * \`cat\`
700
+ * \`dog\`
701
+ * \`fish\`: 2nd fish
702
+ * \`bird\`: 2nd bird
703
+
704
+ Source: [${ SCHEMA_ID } ](file:///${ SCHEMA_ID } )`
705
+ ) ;
706
+ } ) ;
707
+
708
+ it ( 'Hover displays unique enum values with prroper description (3rd case)' , async ( ) => {
709
+ schemaProvider . addSchema ( SCHEMA_ID , {
710
+ type : 'object' ,
711
+ properties : {
712
+ animal : {
713
+ description : 'should return this description' ,
714
+ anyOf : [
715
+ {
716
+ enum : [ 'cat' , 'dog' , 'fish' ] ,
717
+ enumDescriptions : [ '1st cat' , '1st dog' , '1st fish' ] , // should use this description for "fish"
718
+ } ,
719
+ {
720
+ enum : [ 'bird' , 'fish' , 'ant' ] ,
721
+ enumDescriptions : [ '2nd bird' , '2nd fish' , '2nd ant' ] ,
722
+ } ,
723
+ ] ,
724
+ } ,
725
+ } ,
726
+ } ) ;
727
+ const content = 'animal:\n fis|n|' ; // len: 13, pos: 12
728
+ const result = await parseSetup ( content ) ;
729
+
730
+ assert . strictEqual ( MarkupContent . is ( result . contents ) , true ) ;
731
+ assert . strictEqual ( ( result . contents as MarkupContent ) . kind , 'markdown' ) ;
732
+ assert . strictEqual (
733
+ ( result . contents as MarkupContent ) . value ,
734
+ `should return this description
735
+
736
+ Allowed Values:
737
+
738
+ * \`ant\`: 2nd ant
739
+ * \`cat\`: 1st cat
740
+ * \`dog\`: 1st dog
741
+ * \`fish\`: 1st fish
742
+ * \`bird\`: 2nd bird
743
+
626
744
Source: [${ SCHEMA_ID } ](file:///${ SCHEMA_ID } )`
627
745
) ;
628
746
} ) ;
0 commit comments