File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -222,3 +222,36 @@ test('load external js', function (t) {
222222 t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf with a custom page size and footer' )
223223 } )
224224} )
225+
226+ test ( 'load with cookies js' , function ( t ) {
227+ t . plan ( 3 )
228+
229+ var server = require ( 'http' ) . createServer ( function ( req , res ) {
230+ res . write ( req . headers . cookie )
231+ res . end ( )
232+ } )
233+
234+ server . listen ( 0 , function ( err ) {
235+ t . error ( err , 'http server for iframe started' )
236+
237+ var port = server . address ( ) . port
238+ var filename = path . join ( __dirname , 'cookies.pdf' )
239+ pdf . create ( `
240+ <body>here is an iframe which receives the cookies
241+ <iframe src="http://localhost:${ port } " width="400" height="100"></iframe>
242+ </body>
243+ ` , {
244+ httpCookies : [ {
245+ name : 'Valid-Cookie-Name' ,
246+ value : 'Valid-Cookie-Value' ,
247+ domain : 'localhost' ,
248+ path : '/'
249+ } ]
250+ } )
251+ . toFile ( filename , function ( error , pdf ) {
252+ server . close ( )
253+ t . error ( error , 'There must be no render error' )
254+ t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf' )
255+ } )
256+ } )
257+ } )
You can’t perform that action at this time.
0 commit comments