-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure external resources are configured correctly on save (#2452)
* Ensure external resources are configured correctly on save * Add test
- Loading branch information
1 parent
e1713d0
commit db57c8e
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |