@@ -1410,6 +1410,14 @@ describe('Canvas', function () {
14101410 assert . strictEqual ( pattern . toString ( ) , '[object CanvasPattern]' )
14111411 } )
14121412
1413+ it ( 'CanvasPattern has class string of `CanvasPattern`' , async function ( ) {
1414+ const img = await loadImage ( path . join ( __dirname , '/fixtures/checkers.png' ) ) ;
1415+ const canvas = createCanvas ( 20 , 20 )
1416+ const ctx = canvas . getContext ( '2d' )
1417+ const pattern = ctx . createPattern ( img )
1418+ assert . strictEqual ( Object . prototype . toString . call ( pattern ) , '[object CanvasPattern]' )
1419+ } )
1420+
14131421 it ( 'Context2d#createLinearGradient()' , function ( ) {
14141422 const canvas = createCanvas ( 20 , 1 )
14151423 const ctx = canvas . getContext ( '2d' )
@@ -1439,6 +1447,11 @@ describe('Canvas', function () {
14391447 assert . equal ( 0 , imageData . data [ i + 2 ] )
14401448 assert . equal ( 255 , imageData . data [ i + 3 ] )
14411449 } )
1450+ it ( 'Canvas has class string of `HTMLCanvasElement`' , function ( ) {
1451+ const canvas = createCanvas ( 20 , 1 )
1452+
1453+ assert . strictEqual ( Object . prototype . toString . call ( canvas ) , '[object HTMLCanvasElement]' )
1454+ } )
14421455
14431456 it ( 'CanvasGradient stringifies as [object CanvasGradient]' , function ( ) {
14441457 const canvas = createCanvas ( 20 , 1 )
@@ -1447,6 +1460,13 @@ describe('Canvas', function () {
14471460 assert . strictEqual ( gradient . toString ( ) , '[object CanvasGradient]' )
14481461 } )
14491462
1463+ it ( 'CanvasGradient has class string of `CanvasGradient`' , function ( ) {
1464+ const canvas = createCanvas ( 20 , 1 )
1465+ const ctx = canvas . getContext ( '2d' )
1466+ const gradient = ctx . createLinearGradient ( 1 , 1 , 19 , 1 )
1467+ assert . strictEqual ( Object . prototype . toString . call ( gradient ) , '[object CanvasGradient]' )
1468+ } )
1469+
14501470 describe ( 'Context2d#putImageData()' , function ( ) {
14511471 it ( 'throws for invalid arguments' , function ( ) {
14521472 const canvas = createCanvas ( 2 , 1 )
@@ -1943,7 +1963,7 @@ describe('Canvas', function () {
19431963 ctx [ k ] = v
19441964 ctx . restore ( )
19451965 assert . strictEqual ( ctx [ k ] , old )
1946-
1966+
19471967 // save() doesn't modify the value:
19481968 ctx [ k ] = v
19491969 old = ctx [ k ]
0 commit comments