Browse Source

Added spec

pull/763/head
CallumVass 10 years ago
parent
commit
1840cb33ee
  1. 9
      .gitignore
  2. 2
      htdocs/samples/api_legend.html
  3. 56
      spec/api.legend-spec.js

9
.gitignore vendored

@ -5,11 +5,4 @@ d3.js
d3.min.js d3.min.js
components components
build build
.idea/.name .idea
.idea/c3.iml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/workspace.xml

2
htdocs/samples/api_legend.html

@ -10,7 +10,7 @@
<script> <script>
var columns = []; var columns = [];
for (var i = 0; i < 5; i++ ) { for (var i = 0; i < 5; i++) {
columns[i] = ['datahogehogeohgeohoge' + i, 10 * i, 20 * i, 30 * i]; columns[i] = ['datahogehogeohgeohoge' + i, 10 * i, 20 * i, 30 * i];
} }

56
spec/api.legend-spec.js

@ -0,0 +1,56 @@
var describe = window.describe,
expect = window.expect,
it = window.it,
beforeEach = window.beforeEach;
describe('c3 api legend', function () {
'use strict';
var chart, d3;
var args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
},
legend: {
position: 'bottom'
}
};
beforeEach(function (done) {
if (typeof chart === 'undefined') {
window.initDom();
}
chart = window.c3.generate(args);
d3 = chart.internal.d3;
chart.internal.d3.select('.jasmine_html-reporter')
.style('position', 'absolute')
.style('right', 0);
window.setTimeout(function () {
done();
}, 10);
});
describe('legend position', function () {
it('should be located at the bottom of the chart', function () {
expect(true).toBeTruthy();
});
it('should be located to the right of the chart', function () {
chart.legend.position('right');
expect(true).toBeTruthy();
});
it('should be located at the bottom of the chart', function () {
chart.legend.position('bottom');
expect(true).toBeTruthy();
});
});
});
Loading…
Cancel
Save