@@ -4,20 +4,26 @@ import {JSDOM} from "jsdom";
44
55it ( "Plot.plot supports the document option" , ( ) => {
66 const { window} = new JSDOM ( "" ) ;
7+ global . navigator = window . navigator ;
78 const svg = Plot . plot ( { document : window . document , marks : [ Plot . barY ( [ 1 , 2 , 4 , 3 ] ) ] } ) ;
89 assert . strictEqual ( svg . ownerDocument , window . document ) ;
10+ delete global . navigator ;
911} ) ;
1012
1113it ( "Plot.plot supports the document option for inline legends" , ( ) => {
1214 const { window} = new JSDOM ( "" ) ;
15+ global . navigator = window . navigator ;
1316 const figure = Plot . plot ( { document : window . document , color : { legend : true } , marks : [ Plot . cellX ( [ 1 , 2 , 4 , 3 ] ) ] } ) ;
1417 assert . strictEqual ( figure . ownerDocument , window . document ) ;
18+ delete global . navigator ;
1519} ) ;
1620
1721it ( "mark.plot supports the document option" , ( ) => {
1822 const { window} = new JSDOM ( "" ) ;
23+ global . navigator = window . navigator ;
1924 const svg = Plot . barY ( [ 1 , 2 , 4 , 3 ] ) . plot ( { document : window . document } ) ;
2025 assert . strictEqual ( svg . ownerDocument , window . document ) ;
26+ delete global . navigator ;
2127} ) ;
2228
2329it ( "Plot.legend supports the document option" , ( ) => {
@@ -29,32 +35,40 @@ it("Plot.legend supports the document option", () => {
2935it ( "plot.legend supports the document option for quantitative color scales" , ( ) => {
3036 const { window : window1 } = new JSDOM ( "" ) ;
3137 const { window : window2 } = new JSDOM ( "" ) ;
38+ global . navigator = window1 . navigator ;
3239 const svg = Plot . plot ( { document : window1 . document , marks : [ Plot . cellX ( [ 1 , 2 , 4 , 3 ] ) ] } ) . legend ( "color" , {
3340 document : window2 . document
3441 } ) ;
3542 assert . strictEqual ( svg . ownerDocument , window2 . document ) ;
43+ delete global . navigator ;
3644} ) ;
3745
3846it ( "plot.legend inherits the document option" , ( ) => {
3947 const { window} = new JSDOM ( "" ) ;
48+ global . navigator = window . navigator ;
4049 const svg = Plot . plot ( { document : window . document , marks : [ Plot . cellX ( [ 1 , 2 , 4 , 3 ] ) ] } ) . legend ( "color" ) ;
4150 assert . strictEqual ( svg . ownerDocument , window . document ) ;
51+ delete global . navigator ;
4252} ) ;
4353
4454it ( "plot.legend inherits the document option if that option is present but undefined" , ( ) => {
4555 const { window} = new JSDOM ( "" ) ;
56+ global . navigator = window . navigator ;
4657 const svg = Plot . plot ( { document : window . document , marks : [ Plot . cellX ( [ 1 , 2 , 4 , 3 ] ) ] } ) . legend ( "color" , {
4758 document : undefined
4859 } ) ;
4960 assert . strictEqual ( svg . ownerDocument , window . document ) ;
61+ delete global . navigator ;
5062} ) ;
5163
5264it ( "plot.legend supports the document option for categorical color scales" , ( ) => {
5365 const { window} = new JSDOM ( "" ) ;
66+ global . navigator = window . navigator ;
5467 const svg = Plot . plot ( {
5568 document : window . document ,
5669 color : { type : "categorical" } ,
5770 marks : [ Plot . cellX ( [ 1 , 2 , 4 , 3 ] ) ]
5871 } ) . legend ( "color" ) ;
5972 assert . strictEqual ( svg . ownerDocument , window . document ) ;
73+ delete global . navigator ;
6074} ) ;
0 commit comments