@@ -323,71 +323,101 @@ describe("Document to SVG conversion", function () {
323323 } ) ;
324324 } ) ;
325325
326- it ( "should take an optional width and height" , function ( ) {
327- document2svg . drawDocumentAsSvg ( docElement , {
328- width : 42 ,
329- height : 4711 ,
330- } ) ;
326+ it ( "should take an optional width and height" , function ( done ) {
327+ document2svg
328+ . drawDocumentAsSvg ( docElement , {
329+ width : 42 ,
330+ height : 4711 ,
331+ } )
332+ . then ( function ( ) {
333+ expect (
334+ browser . calculateDocumentContentSize
335+ ) . toHaveBeenCalledWith ( docElement , {
336+ width : 42 ,
337+ height : 4711 ,
338+ } ) ;
331339
332- expect ( browser . calculateDocumentContentSize ) . toHaveBeenCalledWith (
333- docElement ,
334- { width : 42 , height : 4711 }
335- ) ;
340+ done ( ) ;
341+ } ) ;
336342 } ) ;
337343
338- it ( "should trigger hover effect" , function ( ) {
339- document2svg . drawDocumentAsSvg ( docElement , { hover : ".mySpan" } ) ;
344+ it ( "should trigger hover effect" , function ( done ) {
345+ document2svg
346+ . drawDocumentAsSvg ( docElement , { hover : ".mySpan" } )
347+ . then ( function ( ) {
348+ expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
349+ docElement ,
350+ ".mySpan" ,
351+ "hover"
352+ ) ;
340353
341- expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
342- docElement ,
343- ".mySpan" ,
344- "hover"
345- ) ;
354+ done ( ) ;
355+ } ) ;
346356 } ) ;
347357
348- it ( "should trigger active effect" , function ( ) {
349- document2svg . drawDocumentAsSvg ( docElement , { active : ".mySpan" } ) ;
358+ it ( "should trigger active effect" , function ( done ) {
359+ document2svg
360+ . drawDocumentAsSvg ( docElement , { active : ".mySpan" } )
361+ . then ( function ( ) {
362+ expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
363+ docElement ,
364+ ".mySpan" ,
365+ "active"
366+ ) ;
350367
351- expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
352- docElement ,
353- ".mySpan" ,
354- "active"
355- ) ;
368+ done ( ) ;
369+ } ) ;
356370 } ) ;
357371
358- it ( "should trigger focus effect" , function ( ) {
359- document2svg . drawDocumentAsSvg ( docElement , { focus : ".mySpan" } ) ;
372+ it ( "should trigger focus effect" , function ( done ) {
373+ document2svg
374+ . drawDocumentAsSvg ( docElement , { focus : ".mySpan" } )
375+ . then ( function ( ) {
376+ expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
377+ docElement ,
378+ ".mySpan" ,
379+ "focus"
380+ ) ;
360381
361- expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
362- docElement ,
363- ".mySpan" ,
364- "focus"
365- ) ;
382+ done ( ) ;
383+ } ) ;
366384 } ) ;
367385
368- it ( "should trigger target effect" , function ( ) {
369- document2svg . drawDocumentAsSvg ( docElement , { target : ".mySpan" } ) ;
386+ it ( "should trigger target effect" , function ( done ) {
387+ document2svg
388+ . drawDocumentAsSvg ( docElement , { target : ".mySpan" } )
389+ . then ( function ( ) {
390+ expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
391+ docElement ,
392+ ".mySpan" ,
393+ "target"
394+ ) ;
370395
371- expect ( documentHelper . fakeUserAction ) . toHaveBeenCalledWith (
372- docElement ,
373- ".mySpan" ,
374- "target"
375- ) ;
396+ done ( ) ;
397+ } ) ;
376398 } ) ;
377399
378- it ( "should not trigger focus effect by default" , function ( ) {
379- document2svg . drawDocumentAsSvg ( docElement , { } ) ;
400+ it ( "should not trigger focus effect by default" , function ( done ) {
401+ document2svg . drawDocumentAsSvg ( docElement , { } ) . then ( function ( ) {
402+ expect ( documentHelper . fakeUserAction ) . not . toHaveBeenCalled ( ) ;
380403
381- expect ( documentHelper . fakeUserAction ) . not . toHaveBeenCalled ( ) ;
404+ done ( ) ;
405+ } ) ;
382406 } ) ;
383407
384- it ( "should render the selected element" , function ( ) {
385- document2svg . drawDocumentAsSvg ( docElement , { clip : ".mySpan" } ) ;
408+ it ( "should render the selected element" , function ( done ) {
409+ document2svg
410+ . drawDocumentAsSvg ( docElement , { clip : ".mySpan" } )
411+ . then ( function ( ) {
412+ expect (
413+ browser . calculateDocumentContentSize
414+ ) . toHaveBeenCalledWith (
415+ docElement ,
416+ jasmine . objectContaining ( { clip : ".mySpan" } )
417+ ) ;
386418
387- expect ( browser . calculateDocumentContentSize ) . toHaveBeenCalledWith (
388- docElement ,
389- jasmine . objectContaining ( { clip : ".mySpan" } )
390- ) ;
419+ done ( ) ;
420+ } ) ;
391421 } ) ;
392422 } ) ;
393423} ) ;
0 commit comments