@@ -117,6 +117,8 @@ test("Inserting functions", function () {
117
117
118
118
test ( "Drawing" , function ( ) {
119
119
var myGraph = new graph ( ) ;
120
+ var lineTo = jest . fn ( ) ;
121
+ myGraph . ctx . lineTo = lineTo ;
120
122
myGraph . reRoll ( Math . PI * - 0.5 , 0 ) ;
121
123
myGraph . zee = - 2500 ;
122
124
myGraph . colours = [ "red" ] ;
@@ -132,19 +134,15 @@ test("Drawing", function () {
132
134
myGraph . function_switches [ "voyager" ] = false ;
133
135
myGraph . canvas . onmousemove ( { buttons : 2 , movementX : 2 , movementY : - 1 } ) ;
134
136
myGraph . canvas . onmousemove ( { buttons : 3 , movementX : 2 , movementY : - 1 } ) ;
137
+ expect ( lineTo ) . toHaveBeenCalled ( ) ;
138
+ lineTo = jest . fn ( ) ;
139
+ myGraph . ctx . lineTo = lineTo ;
135
140
delete myGraph . ctx ;
136
141
myGraph . draw ( ) ;
137
142
Object . defineProperty ( myGraph . canvas , "offsetWidth" , { value : 100 , writable : false } ) ;
138
143
Object . defineProperty ( myGraph . canvas , "offsetHeight" , { value : 100 , writable : false } ) ;
139
144
myGraph . draw ( ) ;
140
- } ) ;
141
-
142
- test ( "Drawing in <div>." , function ( ) {
143
- var g = document . getElementById ;
144
- buildDiv ( "graph_id" ) ;
145
- var myGraph = new graph ( "graph_id" ) ;
146
- myGraph . draw ( ) ;
147
- document . getElementById = g ;
145
+ expect ( lineTo ) . not . toHaveBeenCalled ( ) ;
148
146
} ) ;
149
147
150
148
test ( "Insert switch panel into <body>." , function ( ) {
0 commit comments