1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT License.
3
- import { AdaptiveCard , SerializationContext , TextBlock } from ' ../../card-elements' ;
4
- import { Carousel , CarouselPage } from ' ../../carousel' ;
5
- import { ValidationEvent } from ' ../../enums' ;
6
- import { CarouselConfig } from ' ../../host-config' ;
3
+ import { AdaptiveCard , SerializationContext , TextBlock } from " ../../card-elements" ;
4
+ import { Carousel , CarouselPage } from " ../../carousel" ;
5
+ import { ValidationEvent } from " ../../enums" ;
6
+ import { CarouselConfig } from " ../../host-config" ;
7
7
8
- describe ( ' carousels' , ( ) => {
9
- describe ( ' when default constructed' , ( ) => {
8
+ describe ( " carousels" , ( ) => {
9
+ describe ( " when default constructed" , ( ) => {
10
10
const defaultCarousel = new Carousel ( ) ;
11
11
12
- it ( ' should have reasonable default values' , ( ) => {
12
+ it ( " should have reasonable default values" , ( ) => {
13
13
expect ( defaultCarousel . getJsonTypeName ( ) ) . toBe ( "Carousel" ) ;
14
14
expect ( defaultCarousel . getItemCount ( ) ) . toEqual ( 0 ) ;
15
15
expect ( defaultCarousel . getAllInputs ( ) ) . toStrictEqual ( [ ] ) ;
@@ -18,7 +18,7 @@ describe('carousels', () => {
18
18
} ) ;
19
19
} ) ;
20
20
21
- describe ( ' when parsed from a valid object' , ( ) => {
21
+ describe ( " when parsed from a valid object" , ( ) => {
22
22
const tinyTimer = 42 ;
23
23
24
24
const carouselTheJson = {
@@ -53,11 +53,17 @@ describe('carousels', () => {
53
53
54
54
let carouselTheObject : Carousel ;
55
55
56
- it ( 'shouldn\'t throw exceptions' , ( ) => {
57
- carouselTheObject = context . parseElement ( undefined , carouselTheJson , [ ] , false , true ) as Carousel ;
56
+ it ( "shouldn't throw exceptions" , ( ) => {
57
+ carouselTheObject = context . parseElement (
58
+ undefined ,
59
+ carouselTheJson ,
60
+ [ ] ,
61
+ false ,
62
+ true
63
+ ) as Carousel ;
58
64
} ) ;
59
65
60
- it ( ' should have all of its expected properties and child elements' , ( ) => {
66
+ it ( " should have all of its expected properties and child elements" , ( ) => {
61
67
expect ( carouselTheObject . timer ) . toEqual ( carouselConfig . minAutoplayDelay ) ;
62
68
expect ( carouselTheObject . getItemCount ( ) ) . toBe ( 2 ) ;
63
69
for ( let i = 0 ; i < carouselTheObject . getItemCount ( ) ; i ++ ) {
@@ -70,7 +76,7 @@ describe('carousels', () => {
70
76
}
71
77
} ) ;
72
78
73
- it ( ' shouldn\ 't allow anything in pages but CarouselPages' , ( ) => {
79
+ it ( " shouldn't allow anything in pages but CarouselPages" , ( ) => {
74
80
const incorrectTypeCarousel = {
75
81
"type" : "Carousel" ,
76
82
"pages" : [
@@ -80,15 +86,21 @@ describe('carousels', () => {
80
86
]
81
87
} ;
82
88
83
- let incorrectTypeParsed = context . parseElement ( undefined , incorrectTypeCarousel , [ ] , false , true ) as Carousel ;
89
+ let incorrectTypeParsed = context . parseElement (
90
+ undefined ,
91
+ incorrectTypeCarousel ,
92
+ [ ] ,
93
+ false ,
94
+ true
95
+ ) as Carousel ;
84
96
expect ( incorrectTypeParsed . getItemCount ( ) ) . toBe ( 0 ) ;
85
97
expect ( context . eventCount ) . toBe ( 1 ) ;
86
98
expect ( context . getEventAt ( 0 ) . event ) . toBe ( ValidationEvent . ElementTypeNotAllowed ) ;
87
99
} ) ;
88
100
} ) ;
89
101
90
- describe ( ' certain elements' , ( ) => {
91
- it ( ' shouldn\ 't be allowed within a Carousel' , ( ) => {
102
+ describe ( " certain elements" , ( ) => {
103
+ it ( " shouldn't be allowed within a Carousel" , ( ) => {
92
104
const carouselCard = {
93
105
"type" : "AdaptiveCard" ,
94
106
"body" : {
@@ -128,12 +140,12 @@ describe('carousels', () => {
128
140
expect ( theCard . getActionCount ( ) ) . toBe ( 0 ) ;
129
141
130
142
expect ( context . eventCount ) . toBe ( 2 ) ;
131
- } )
143
+ } ) ;
132
144
} ) ;
133
145
} ) ;
134
146
135
- describe ( ' carousel pages' , ( ) => {
136
- it ( ' shouldn\ 't be parseable outside of a Carousel' , ( ) => {
147
+ describe ( " carousel pages" , ( ) => {
148
+ it ( " shouldn't be parseable outside of a Carousel" , ( ) => {
137
149
const context = new SerializationContext ( ) ;
138
150
const pageObject = {
139
151
"type" : "CarouselPage" ,
@@ -143,7 +155,7 @@ describe('carousel pages', () => {
143
155
"text" : "unthinkable!"
144
156
}
145
157
]
146
- }
158
+ } ;
147
159
expect ( context . parseElement ( undefined , pageObject , [ ] , false ) ) . toBeUndefined ( ) ;
148
160
expect ( context . eventCount ) . toBe ( 1 ) ;
149
161
expect ( context . getEventAt ( 0 ) . event ) . toBe ( ValidationEvent . UnknownElementType ) ;
0 commit comments