@@ -11,38 +11,38 @@ describe('AttachmentConfigurationService', () => {
1111
1212 it ( 'should provide the correct configuration for image attachments' , ( ) => {
1313 let attachment : Attachment = {
14- img_url : 'url/to/img' ,
14+ img_url : 'http:// url/to/img' ,
1515 thumb_url : 'different/url' ,
1616 } ;
1717
1818 expect (
1919 service . getImageAttachmentConfiguration ( attachment , 'single' )
2020 ) . toEqual ( {
21- url : 'url/to/img& h=600&w=600' ,
21+ url : 'http:// url/to/img? h=600&w=600' ,
2222 height : '300px' ,
2323 width : '' ,
2424 } ) ;
2525
2626 attachment = {
27- thumb_url : 'url/to/img' ,
27+ thumb_url : 'http:// url/to/img' ,
2828 } ;
2929
3030 expect (
3131 service . getImageAttachmentConfiguration ( attachment , 'single' )
3232 ) . toEqual ( {
33- url : 'url/to/img& h=600&w=600' ,
33+ url : 'http:// url/to/img? h=600&w=600' ,
3434 height : '300px' ,
3535 width : '' ,
3636 } ) ;
3737
3838 attachment = {
39- image_url : 'url/to/img' ,
39+ image_url : 'http:// url/to/img' ,
4040 } ;
4141
4242 expect (
4343 service . getImageAttachmentConfiguration ( attachment , 'single' )
4444 ) . toEqual ( {
45- url : 'url/to/img& h=600&w=600' ,
45+ url : 'http:// url/to/img? h=600&w=600' ,
4646 height : '300px' ,
4747 width : '' ,
4848 } ) ;
@@ -52,7 +52,7 @@ describe('AttachmentConfigurationService', () => {
5252 const spy = jasmine . createSpy ( ) ;
5353 service . customImageAttachmentConfigurationHandler = spy ;
5454 const attachment : Attachment = {
55- img_url : 'url/to/img' ,
55+ img_url : 'http:// url/to/img' ,
5656 thumb_url : 'different/url' ,
5757 } ;
5858 service . getImageAttachmentConfiguration ( attachment , 'carousel' ) ;
@@ -62,51 +62,74 @@ describe('AttachmentConfigurationService', () => {
6262
6363 it ( 'should provide the correct configuration for gallery image attachments' , ( ) => {
6464 const attachment : Attachment = {
65- img_url : 'url/to/img' ,
65+ img_url : 'http:// url/to/img' ,
6666 } ;
6767
6868 expect (
6969 service . getImageAttachmentConfiguration ( attachment , 'gallery' )
7070 ) . toEqual ( {
71- url : 'url/to/img& h=300&w=300' ,
71+ url : 'http:// url/to/img? h=300&w=300' ,
7272 height : '150px' ,
7373 width : '' ,
7474 } ) ;
7575 } ) ;
7676
7777 it ( 'should provide the correct configuration for image attachments inside the carousel' , ( ) => {
7878 const attachment : Attachment = {
79- img_url : 'url/to/img' ,
79+ img_url : 'http:// url/to/img' ,
8080 } ;
8181
8282 expect (
8383 service . getImageAttachmentConfiguration ( attachment , 'carousel' )
8484 ) . toEqual ( {
85- url : 'url/to/img' ,
85+ url : 'http:// url/to/img' ,
8686 height : '' ,
8787 width : '' ,
8888 } ) ;
8989 } ) ;
9090
9191 it ( 'should provide the correct configuration for video attachments' , ( ) => {
92- const attachment : Attachment = {
93- asset_url : 'url/to/video' ,
94- thumb_url : 'url/to/poster' ,
92+ let attachment : Attachment = {
93+ asset_url : 'http://url/to/video' ,
94+ thumb_url : 'http://url/to/poster' ,
95+ } ;
96+
97+ expect ( service . getVideoAttachmentConfiguration ( attachment ) ) . toEqual ( {
98+ url : 'http://url/to/video' ,
99+ height : '100%' ,
100+ width : '100%' ,
101+ thumbUrl : 'http://url/to/poster?h=600&w=600' ,
102+ } ) ;
103+
104+ attachment = {
105+ asset_url : 'http://url/to/video' ,
106+ thumb_url : 'http://url/to/poster?oh=1080&ow=1920' ,
107+ } ;
108+
109+ expect ( service . getVideoAttachmentConfiguration ( attachment ) ) . toEqual ( {
110+ url : 'http://url/to/video' ,
111+ height : '100%' ,
112+ width : '100%' ,
113+ thumbUrl : 'http://url/to/poster?oh=1080&ow=1920&h=600&w=1067' ,
114+ } ) ;
115+
116+ attachment = {
117+ asset_url : 'http://url/to/video' ,
95118 } ;
96119
97120 expect ( service . getVideoAttachmentConfiguration ( attachment ) ) . toEqual ( {
98- url : 'url/to/video' ,
121+ url : 'http:// url/to/video' ,
99122 height : '100%' ,
100123 width : '100%' ,
101- thumbUrl : 'url/to/poster' ,
124+ thumbUrl : undefined ,
102125 } ) ;
103126 } ) ;
104127
105128 it ( 'should call #customVideoAttachmentConfigurationHandler, if provided' , ( ) => {
106129 const spy = jasmine . createSpy ( ) ;
107130 service . customVideoAttachmentConfigurationHandler = spy ;
108131 const attachment : Attachment = {
109- img_url : 'url/to/video' ,
132+ img_url : 'http:// url/to/video' ,
110133 thumb_url : 'different/url' ,
111134 } ;
112135 service . getVideoAttachmentConfiguration ( attachment ) ;
@@ -169,12 +192,12 @@ describe('AttachmentConfigurationService', () => {
169192
170193 it ( 'should provide correct configuration for scraped images' , ( ) => {
171194 let attachment : Attachment = {
172- image_url : 'url/to/img' ,
195+ image_url : 'http:// url/to/img' ,
173196 thumb_url : 'different/url' ,
174197 } ;
175198
176199 expect ( service . getScrapedImageAttachmentConfiguration ( attachment ) ) . toEqual ( {
177- url : 'url/to/img' ,
200+ url : 'http:// url/to/img' ,
178201 width : '' ,
179202 height : '' ,
180203 } ) ;
@@ -203,16 +226,14 @@ describe('AttachmentConfigurationService', () => {
203226
204227 it ( 'should provide integer values for image resize and make sure that each dimension is at least the size restriction' , ( ) => {
205228 const attachment = {
206- img_url : 'url/to/img' ,
207- original_width : 3534 ,
208- original_height : 4417 ,
229+ img_url : 'http://url/to/img?ow=3534&oh=4417' ,
209230 } ;
210231
211232 const result = service . getImageAttachmentConfiguration (
212233 attachment ,
213234 'single'
214235 ) ;
215236
216- expect ( result . url ) . toContain ( '& h=750&w=600' ) ;
237+ expect ( result . url ) . toContain ( 'h=750&w=600' ) ;
217238 } ) ;
218239} ) ;
0 commit comments