@@ -107,39 +107,156 @@ test.describe('Feedzy Loop', () => {
107107 expect ( feedzyLoopChildren . length ) . toBe ( 5 ) ;
108108 } ) ;
109109
110- test ( 'check validation for invalid URL' , async ( { editor, page, admin } ) => {
110+ test ( 'check validation for invalid URL' , async ( {
111+ editor,
112+ page,
113+ admin,
114+ } ) => {
111115 await admin . createNewPost ( ) ;
112116
113117 await editor . insertBlock ( {
114118 name : 'feedzy-rss-feeds/loop' ,
115119 } ) ;
116120
117- await page . getByPlaceholder ( 'Enter URLs or select a Feed' ) . fill (
118- 'http://invalid-url.com/feed'
119- ) ;
121+ await page
122+ . getByPlaceholder ( 'Enter URLs or select a Feed' )
123+ . fill ( 'http://invalid-url.com/feed' ) ;
120124 await page . getByRole ( 'button' , { name : 'Load Feed' } ) . click ( ) ;
121125
122126 await page . waitForSelector ( '.feedzy-validation-results' ) ;
123127
124- await expect ( page . locator ( '.feedzy-validation-results .is-error' ) . getByText ( 'http://invalid-url.com/feed' , { exact : true } ) ) . toBeVisible ( ) ;
128+ await expect (
129+ page
130+ . locator ( '.feedzy-validation-results .is-error' )
131+ . getByText ( 'http://invalid-url.com/feed' , { exact : true } )
132+ ) . toBeVisible ( ) ;
125133 } ) ;
126134
127- test ( 'check validation for invalid and valid url' , async ( { editor, page, admin } ) => {
135+ test ( 'check validation for invalid and valid url' , async ( {
136+ editor,
137+ page,
138+ admin,
139+ } ) => {
128140 await admin . createNewPost ( ) ;
129141
130142 await editor . insertBlock ( {
131143 name : 'feedzy-rss-feeds/loop' ,
132144 } ) ;
133145
134- await page . getByPlaceholder ( 'Enter URLs or select a Feed' ) . fill (
135- 'http://invalid-url.com/feed, https://www.nasa.gov/feeds/iotd-feed/'
136- ) ;
146+ await page
147+ . getByPlaceholder ( 'Enter URLs or select a Feed' )
148+ . fill (
149+ 'http://invalid-url.com/feed, https://www.nasa.gov/feeds/iotd-feed/'
150+ ) ;
137151 await page . getByRole ( 'button' , { name : 'Load Feed' } ) . click ( ) ;
138152
139153 await page . waitForSelector ( '.feedzy-validation-results' ) ;
140154
141- await expect ( page . locator ( '.feedzy-validation-results .is-error' ) . getByText ( 'http://invalid-url.com/feed' , { exact : true } ) ) . toBeVisible ( ) ;
155+ await expect (
156+ page
157+ . locator ( '.feedzy-validation-results .is-error' )
158+ . getByText ( 'http://invalid-url.com/feed' , { exact : true } )
159+ ) . toBeVisible ( ) ;
160+
161+ await expect (
162+ page
163+ . locator ( '.feedzy-validation-results .is-success' )
164+ . getByText ( 'https://www.nasa.gov/feeds/iotd-feed/' , {
165+ exact : true ,
166+ } )
167+ ) . toBeVisible ( ) ;
168+ } ) ;
169+
170+ test ( 'check thumbnail display' , async ( { editor, page, admin } ) => {
171+ await admin . createNewPost ( ) ;
172+
173+ await editor . insertBlock ( {
174+ name : 'feedzy-rss-feeds/loop' ,
175+ attributes : {
176+ feed : {
177+ type : 'url' ,
178+ source : 'https://www.nasa.gov/feeds/iotd-feed/' ,
179+ } ,
180+ query : {
181+ max : 1 ,
182+ } ,
183+ } ,
184+ } ) ;
185+
186+ await page
187+ . getByLabel ( 'Display curated RSS content' )
188+ . click ( { force : true } ) ;
189+
190+ await page . waitForSelector ( '.feedzy-loop-columns-1' ) ;
191+
192+ expect (
193+ await page
194+ . locator ( `.wp-block-feedzy-rss-feeds-loop img[src*="https"]` )
195+ . count ( )
196+ ) . toBeGreaterThan ( 0 ) ;
197+ } ) ;
198+
199+ test ( 'check no thumbnail display' , async ( { editor, page, admin } ) => {
200+ await admin . createNewPost ( ) ;
201+
202+ await editor . insertBlock ( {
203+ name : 'feedzy-rss-feeds/loop' ,
204+ attributes : {
205+ feed : {
206+ type : 'url' ,
207+ source : 'https://www.nasa.gov/feeds/iotd-feed/' ,
208+ } ,
209+ query : {
210+ max : 1 ,
211+ } ,
212+ thumb : 'no' ,
213+ } ,
214+ } ) ;
215+
216+ await page
217+ . getByLabel ( 'Display curated RSS content' )
218+ . click ( { force : true } ) ;
219+
220+ await page . waitForSelector ( '.feedzy-loop-columns-1' ) ;
221+
222+ expect (
223+ await page
224+ . locator ( `.wp-block-feedzy-rss-feeds-loop img[src*="https"]` )
225+ . count ( )
226+ ) . toBe ( 0 ) ;
227+ } ) ;
228+
229+ test ( 'check default SVG thumbnail display' , async ( {
230+ editor,
231+ page,
232+ admin,
233+ } ) => {
234+ await admin . createNewPost ( ) ;
235+
236+ await editor . insertBlock ( {
237+ name : 'feedzy-rss-feeds/loop' ,
238+ attributes : {
239+ feed : {
240+ type : 'url' ,
241+ source : 'https://fasterthanli.me/index.xml' ,
242+ } ,
243+ query : {
244+ max : 1 ,
245+ } ,
246+ thumb : 'yes' ,
247+ } ,
248+ } ) ;
249+
250+ await page
251+ . getByLabel ( 'Display curated RSS content' )
252+ . click ( { force : true } ) ;
253+
254+ await page . waitForSelector ( '.feedzy-loop-columns-1' ) ;
142255
143- await expect ( page . locator ( '.feedzy-validation-results .is-success' ) . getByText ( 'https://www.nasa.gov/feeds/iotd-feed/' , { exact : true } ) ) . toBeVisible ( ) ;
256+ expect (
257+ await page
258+ . locator ( `.wp-block-feedzy-rss-feeds-loop img[src*=".svg"]` )
259+ . count ( )
260+ ) . toBeGreaterThan ( 0 ) ;
144261 } ) ;
145262} ) ;
0 commit comments