File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 < script src ="../assets/jquery-1.6.2.js "> </ script >
88 < script src ="lib/expect.js "> </ script >
99 < script src ="lib/mocha.js "> </ script >
10+ < style >
11+ # block2 {
12+ background : red;
13+ }
14+
15+ .my-css-class # block2 {
16+ background : green;
17+ }
18+ </ style >
1019</ head >
1120< body >
1221< div id ="mocha "> </ div >
1322< script > mocha . setup ( 'bdd' ) </ script >
1423< div style ="background: red; width: 200px; height:200px; " id ="block "> </ div >
24+ < div style ="width: 200px; height:200px; " id ="block2 "> </ div >
1525< script >
1626 describe ( "options.onclone" , function ( ) {
1727 it ( "with a function" , function ( done ) {
4656 done ( error ) ;
4757 } ) ;
4858 } ) ;
59+
60+ it ( "add class to node" , function ( done ) {
61+ html2canvas ( document . querySelector ( "#block2" ) , { onclone : function ( document ) {
62+ document . documentElement . className = "my-css-class" ;
63+ } } ) . then ( function ( canvas ) {
64+ expect ( canvas . width ) . to . equal ( 200 ) ;
65+ expect ( canvas . height ) . to . equal ( 200 ) ;
66+ validCanvasPixels ( canvas ) ;
67+ done ( ) ;
68+ } ) . catch ( function ( error ) {
69+ done ( error ) ;
70+ } ) ;
71+ } ) ;
4972 } ) ;
5073
5174 function validCanvasPixels ( canvas ) {
You can’t perform that action at this time.
0 commit comments