@@ -521,6 +521,39 @@ describe('<api-type-document>', () => {
521521 } ) ;
522522 } ) ;
523523
524+ describe ( 'Array type with restrictions' , ( ) => {
525+ let element = /** @type ApiTypeDocument */ ( null ) ;
526+ beforeEach ( async ( ) => {
527+ const data = await AmfLoader . loadType ( 'Emails' , item [ 1 ] , 'array-type' ) ;
528+ element = await basicFixture ( ) ;
529+ element . amf = data [ 0 ] ;
530+ element . type = data [ 1 ] ;
531+ await aTimeout ( 0 ) ;
532+ } ) ;
533+
534+ it ( 'isArray is true' , ( ) => {
535+ assert . isTrue ( element . isArray ) ;
536+ } ) ;
537+
538+ it ( 'Renders array document' , ( ) => {
539+ const doc = element . shadowRoot . querySelector (
540+ 'property-shape-document.array-document'
541+ ) ;
542+ assert . ok ( doc ) ;
543+ } ) ;
544+
545+ it ( 'Renders minItems and maxItems info' , ( ) => {
546+ const properties = element . shadowRoot . querySelectorAll (
547+ '.property-attribute'
548+ ) ;
549+ assert . lengthOf ( properties , 2 ) ;
550+ assert . equal ( properties [ 0 ] . querySelector ( '.attribute-label' ) . innerText , 'Minimum array length:' ) ;
551+ assert . equal ( properties [ 0 ] . querySelector ( '.attribute-value' ) . innerText , '1' ) ;
552+ assert . equal ( properties [ 1 ] . querySelector ( '.attribute-label' ) . innerText , 'Maximum array length:' ) ;
553+ assert . equal ( properties [ 1 ] . querySelector ( '.attribute-value' ) . innerText , '3' ) ;
554+ } ) ;
555+ } ) ;
556+
524557 describe ( 'Scalar type' , ( ) => {
525558 let element = /** @type ApiTypeDocument */ ( null ) ;
526559
0 commit comments