Skip to content

Commit 0511421

Browse files
committed
split ipynb fixture and js test file into two cases:
- one testing offline connected=True - one testing offline connected=False (the default)
1 parent 6ada5b6 commit 0511421

File tree

5 files changed

+119
-15
lines changed

5 files changed

+119
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [],
10+
"source": [
11+
"from plotly.offline import plot, iplot, init_notebook_mode\n",
12+
"import plotly.graph_objs as go\n",
13+
"\n",
14+
"# Make plotly work with Jupyter notebook\n",
15+
"init_notebook_mode(connected=True)\n",
16+
"\n",
17+
"keys=['one','two','three']\n",
18+
"values=[1,2,3]\n",
19+
"\n",
20+
"iplot({\n",
21+
" \"data\": [go.Bar(x=keys, y=values)],\n",
22+
" \"layout\": go.Layout(title=\"Sample Bar Chart\")\n",
23+
"})"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": null,
29+
"metadata": {
30+
"collapsed": true
31+
},
32+
"outputs": [],
33+
"source": []
34+
}
35+
],
36+
"metadata": {
37+
"kernelspec": {
38+
"display_name": "Python 3",
39+
"language": "python",
40+
"name": "python3"
41+
},
42+
"language_info": {
43+
"codemirror_mode": {
44+
"name": "ipython",
45+
"version": 3
46+
},
47+
"file_extension": ".py",
48+
"mimetype": "text/x-python",
49+
"name": "python",
50+
"nbconvert_exporter": "python",
51+
"pygments_lexer": "ipython3",
52+
"version": "3.5.2"
53+
}
54+
},
55+
"nbformat": 4,
56+
"nbformat_minor": 1
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
var test = require('../lib/tape-wrapper');
4+
5+
test('should load plotly.js', function(t) {
6+
t.plan(1);
7+
8+
window.require(['plotly'], function(Plotly) {
9+
t.equal(typeof Plotly, 'object');
10+
});
11+
});
12+
13+
test('should have one plotly.js graph', function(t) {
14+
t.plan(1);
15+
16+
var nodes = document.querySelectorAll('.js-plotly-plot');
17+
t.equal(nodes.length, 1);
18+
});
19+
20+
test('should inject raw plotly.js code into DOM', function(t) {
21+
t.plan(1);
22+
23+
var nodes = document.querySelectorAll('script');
24+
nodes = Array.prototype.slice.call(nodes, 0, 10);
25+
26+
var results = nodes.filter(function(node) {
27+
return node.innerHTML.substr(0, 19) === 'if(!window.Plotly){';
28+
});
29+
30+
t.equal(results.length, 1);
31+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
var test = require('../lib/tape-wrapper');
4+
5+
test('should load plotly.js', function(t) {
6+
t.plan(1);
7+
8+
window.require(['plotly'], function(Plotly) {
9+
t.equal(typeof Plotly, 'object');
10+
});
11+
});
12+
13+
test('should have one plotly.js graph', function(t) {
14+
t.plan(1);
15+
16+
var nodes = document.querySelectorAll('.js-plotly-plot');
17+
t.equal(nodes.length, 1);
18+
});
19+
20+
test('should link to plotly.js CDN', function(t) {
21+
t.plan(1);
22+
23+
var nodes = document.querySelectorAll('script');
24+
nodes = Array.prototype.slice.call(nodes, 0);
25+
26+
var results = nodes.filter(function(node) {
27+
return node.src === 'https://cdn.plot.ly/plotly-latest.min.js';
28+
});
29+
30+
t.equal(results.length, 1);
31+
});

plotly/tests/test_core/test_jupyter/test.js

-15
This file was deleted.

0 commit comments

Comments
 (0)