@@ -127,9 +127,15 @@ describe('AutIframe', () => {
127127 const result = autIframe . create ( )
128128
129129 expect ( result ) . to . have . property ( 'autIframe' )
130- expect ( result ) . to . have . property ( 'autSnapshotIframe ' )
130+ expect ( result ) . to . have . property ( 'autSnapshotIframes ' )
131131 expect ( autIframe . $iframe ) . to . equal ( result . autIframe )
132- expect ( autIframe . $snapshotIframe ) . to . equal ( result . autSnapshotIframe )
132+ expect ( autIframe . $snapshotIframes ) . to . equal ( result . autSnapshotIframes )
133+ expect ( result . autSnapshotIframes . length ) . to . equal ( 2 )
134+ result . autSnapshotIframes . forEach ( ( iframe ) => {
135+ expect ( iframe . is ( ':hidden' ) ) . to . be . true
136+ expect ( iframe . hasClass ( 'aut-snapshot-iframe' ) ) . to . be . true
137+ expect ( iframe . attr ( 'data-snapshot-index' ) ) . to . exist
138+ } )
133139 } )
134140
135141 it ( 'should create aut iframe with correct attributes' , ( ) => {
@@ -143,20 +149,21 @@ describe('AutIframe', () => {
143149
144150 it ( 'should create snapshot iframe with correct attributes' , ( ) => {
145151 const result = autIframe . create ( )
146- const snapshotIframeElement = result . autSnapshotIframe [ 0 ] as HTMLIFrameElement
147152
148- expect ( snapshotIframeElement . id ) . to . equal ( 'AUT Snapshot: \'Test Project\'' )
149- expect ( snapshotIframeElement . title ) . to . equal ( 'AUT Snapshot: \'Test Project\'' )
150- expect ( snapshotIframeElement . className ) . to . equal ( 'aut-snapshot-iframe' )
153+ result . autSnapshotIframes . forEach ( ( iframe ) => {
154+ expect ( iframe [ 0 ] . id ) . to . equal ( `AUT Snapshot - ${ iframe . data ( 'snapshot-index' ) } : \'Test Project\'` )
155+ expect ( iframe [ 0 ] . title ) . to . equal ( `AUT Snapshot - ${ iframe . data ( 'snapshot-index' ) } : \'Test Project\'` )
156+ expect ( iframe [ 0 ] . className ) . to . equal ( 'aut-snapshot-iframe' )
157+ } )
151158 } )
152159
153160 it ( 'verify the snapshot iframe is hidden' , ( ) => {
154161 const result = autIframe . create ( )
155162
156- result . autSnapshotIframe . appendTo ( document . body )
163+ result . autSnapshotIframes [ 0 ] . appendTo ( document . body )
157164 result . autIframe . appendTo ( document . body )
158165
159- expect ( result . autSnapshotIframe . is ( ':hidden' ) ) . to . be . true
166+ expect ( result . autSnapshotIframes [ 0 ] . is ( ':hidden' ) ) . to . be . true
160167 expect ( result . autIframe . is ( ':hidden' ) ) . to . be . false
161168 } )
162169 } )
@@ -165,7 +172,7 @@ describe('AutIframe', () => {
165172 it ( 'should remove both aut iframe and snapshot iframe' , ( ) => {
166173 const result = autIframe . create ( )
167174 let autIframeRemoved = false
168- let snapshotIframeRemoved = false
175+ let snapshotIframesRemoved = [ false , false ]
169176
170177 // Mock remove methods
171178 result . autIframe . remove = ( ) => {
@@ -174,16 +181,18 @@ describe('AutIframe', () => {
174181 return result . autIframe
175182 }
176183
177- result . autSnapshotIframe . remove = ( ) => {
178- snapshotIframeRemoved = true
184+ result . autSnapshotIframes . forEach ( ( snapshotIframe , index ) => {
185+ snapshotIframe . remove = ( ) => {
186+ snapshotIframesRemoved [ index ] = true
179187
180- return result . autSnapshotIframe
181- }
188+ return result . autSnapshotIframes [ index ]
189+ }
190+ } )
182191
183192 autIframe . destroy ( )
184193
185194 expect ( autIframeRemoved ) . to . be . true
186- expect ( snapshotIframeRemoved ) . to . be . true
195+ expect ( snapshotIframesRemoved . every ( ( removed ) => removed ) ) . to . be . true
187196 } )
188197
189198 it ( 'should throw error when destroy is called without create' , ( ) => {
0 commit comments