Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jun 29, 2021
1 parent 01abde0 commit 984a946
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions panel/tests/io/test_save.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from io import StringIO

from panel.pane import Vega
from panel.models.vega import VegaPlot


vega_example = {
'config': {
'mark': {'tooltip': None},
'view': {'height': 300, 'width': 400}
},
'data': {'values': [{'x': 'A', 'y': 5},
{'x': 'B', 'y': 3},
{'x': 'C', 'y': 6},
{'x': 'D', 'y': 7},
{'x': 'E', 'y': 2}]},
'mark': 'bar',
'encoding': {'x': {'type': 'ordinal', 'field': 'x'},
'y': {'type': 'quantitative', 'field': 'y'}},
'$schema': 'https://vega.github.io/schema/vega-lite/v3.2.1.json'
}


def test_save_external():
sio = StringIO()
pane = Vega(vega_example)

pane.save(sio)
sio.seek(0)
html = sio.read()
for js in VegaPlot.__javascript_raw__:
assert js in html

0 comments on commit 984a946

Please sign in to comment.