11import { fixture , assert , nextFrame , aTimeout } from '@open-wc/testing' ;
2- import { AmfLoader } from './amf-loader.js' ;
32import { tap } from '@polymer/iron-test-helpers/mock-interactions.js' ;
3+ import { AmfLoader } from './amf-loader.js' ;
44import '../api-type-document.js' ;
55
66describe ( '<api-type-document>' , function ( ) {
77 const newOas3Types = 'new-oas3-types' ;
88 async function basicFixture ( ) {
9- return await fixture ( `<api-type-document></api-type-document>` ) ;
9+ return fixture ( `<api-type-document></api-type-document>` ) ;
1010 }
1111
1212 function getPayloadType ( element , model , path , methodName ) {
@@ -707,7 +707,7 @@ describe('<api-type-document>', function () {
707707 } ) ;
708708
709709 describe ( 'readOnly properties' , ( ) => {
710- let element
710+ let element ;
711711
712712 beforeEach ( async ( ) => {
713713 const data = await AmfLoader . loadType (
@@ -724,15 +724,21 @@ describe('<api-type-document>', function () {
724724 it ( 'does not render the readOnly properties' , async ( ) => {
725725 element . renderReadOnly = false ;
726726 await nextFrame ( ) ;
727- assert . lengthOf ( element . shadowRoot . querySelectorAll ( 'property-shape-document' ) , 1 ) ;
727+ assert . lengthOf (
728+ element . shadowRoot . querySelectorAll ( 'property-shape-document' ) ,
729+ 1
730+ ) ;
728731 } ) ;
729732
730733 it ( 'renders the readOnly properties' , async ( ) => {
731734 element . renderReadOnly = true ;
732735 await nextFrame ( ) ;
733- assert . lengthOf ( element . shadowRoot . querySelectorAll ( 'property-shape-document' ) , 2 ) ;
736+ assert . lengthOf (
737+ element . shadowRoot . querySelectorAll ( 'property-shape-document' ) ,
738+ 2
739+ ) ;
734740 } ) ;
735- } )
741+ } ) ;
736742 } ) ;
737743 } ) ;
738744
@@ -806,7 +812,7 @@ describe('<api-type-document>', function () {
806812
807813 [
808814 [ 'Regular model - OAS 3 types additions' , false ] ,
809- [ 'Compact model - OAS 3 types additions' , true ]
815+ [ 'Compact model - OAS 3 types additions' , true ] ,
810816 ] . forEach ( ( [ name , compact ] ) => {
811817 describe ( name , ( ) => {
812818 let element ;
@@ -816,7 +822,11 @@ describe('<api-type-document>', function () {
816822 } ) ;
817823
818824 it ( 'should represent type as oneOf' , async ( ) => {
819- const [ amf , type ] = await AmfLoader . loadType ( 'Pet' , compact , newOas3Types )
825+ const [ amf , type ] = await AmfLoader . loadType (
826+ 'Pet' ,
827+ compact ,
828+ newOas3Types
829+ ) ;
820830 element . amf = amf ;
821831 element . type = type ;
822832 await aTimeout ( 0 ) ;
@@ -825,17 +835,25 @@ describe('<api-type-document>', function () {
825835 } ) ;
826836
827837 it ( 'changes selectedOneOf when button clicked' , async ( ) => {
828- const [ amf , type ] = await AmfLoader . loadType ( 'Pet' , compact , newOas3Types )
838+ const [ amf , type ] = await AmfLoader . loadType (
839+ 'Pet' ,
840+ compact ,
841+ newOas3Types
842+ ) ;
829843 element . amf = amf ;
830844 element . type = type ;
831845 await aTimeout ( 0 ) ;
832846 assert . equal ( element . selectedOneOf , 0 ) ;
833- element . shadowRoot . querySelectorAll ( '.one-of-toggle' ) [ 1 ] . click ( )
847+ element . shadowRoot . querySelectorAll ( '.one-of-toggle' ) [ 1 ] . click ( ) ;
834848 assert . equal ( element . selectedOneOf , 1 ) ;
835849 } ) ;
836850
837851 it ( 'should represent type as anyOf' , async ( ) => {
838- const [ amf , type ] = await AmfLoader . loadType ( 'Monster' , compact , newOas3Types )
852+ const [ amf , type ] = await AmfLoader . loadType (
853+ 'Monster' ,
854+ compact ,
855+ newOas3Types
856+ ) ;
839857 element . amf = amf ;
840858 element . type = type ;
841859 await aTimeout ( 0 ) ;
@@ -844,17 +862,48 @@ describe('<api-type-document>', function () {
844862 } ) ;
845863
846864 it ( 'changes selectedAnyOf when button clicked' , async ( ) => {
847- const [ amf , type ] = await AmfLoader . loadType ( 'Monster' , compact , newOas3Types )
865+ const [ amf , type ] = await AmfLoader . loadType (
866+ 'Monster' ,
867+ compact ,
868+ newOas3Types
869+ ) ;
848870 element . amf = amf ;
849871 element . type = type ;
850872 await aTimeout ( 0 ) ;
851873 assert . equal ( element . selectedAnyOf , 0 ) ;
852- element . shadowRoot . querySelectorAll ( '.any-of-toggle' ) [ 1 ] . click ( )
874+ element . shadowRoot . querySelectorAll ( '.any-of-toggle' ) [ 1 ] . click ( ) ;
853875 assert . equal ( element . selectedAnyOf , 1 ) ;
854876 } ) ;
855877 } ) ;
856878 } ) ;
857879
880+ [
881+ [ 'Regular model - AAP-1698' , false ] ,
882+ [ 'Compact model - AAP-1698' , true ] ,
883+ ] . forEach ( ( [ name , compact ] ) => {
884+ describe ( name , ( ) => {
885+ let element ;
886+ let amf ;
887+ let type ;
888+
889+ beforeEach ( async ( ) => {
890+ element = await basicFixture ( ) ;
891+ amf = await AmfLoader . load ( compact , 'aap-1698' ) ;
892+ element . amf = amf ;
893+ [ type ] = getPayloadType ( element , amf , '/not-working' , 'post' ) ;
894+ element . type = type ;
895+ await nextFrame ( ) ;
896+ await aTimeout ( 0 ) ;
897+ } ) ;
898+
899+ it ( 'renders array of enum strings property with partial model' , ( ) => {
900+ assert . exists (
901+ element . shadowRoot . querySelector ( 'property-shape-document' )
902+ ) ;
903+ } ) ;
904+ } ) ;
905+ } ) ;
906+
858907 describe ( '_mediaTypesChanged()' , ( ) => {
859908 let element ;
860909 beforeEach ( async ( ) => {
0 commit comments