Issue #475: Percentage data in flot graphs tests

+ base.js fixtures now include percentage data
+ slickgrid tests updated to hide p field in fixtures
+ added test scenario for percentage data in tests for flot view
This commit is contained in:
Teofilo Sibileau 2015-04-01 14:34:51 -03:00
parent bb0d41a2e4
commit 19f12b1c82
3 changed files with 34 additions and 12 deletions

View File

@ -6,18 +6,19 @@ var Fixture = {
{id: 'x'},
{id: 'y'},
{id: 'z'},
{id: 'p'},
{id: 'country'},
{id: 'title'},
{id: 'lat'},
{id: 'lon'}
];
var documents = [
{id: 0, date: '2011-01-01', x: 1, y: 2, z: 3, country: 'DE', title: 'first', lat:52.56, lon:13.40},
{id: 1, date: '2011-02-02', x: 2, y: 4, z: 24, country: 'UK', title: 'second', lat:54.97, lon:-1.60},
{id: 2, date: '2011-03-03', x: 3, y: 6, z: 9, country: 'US', title: 'third', lat:40.00, lon:-75.5},
{id: 3, date: '2011-04-04', x: 4, y: 8, z: 6, country: 'UK', title: 'fourth', lat:57.27, lon:-6.20},
{id: 4, date: '2011-05-04', x: 5, y: 10, z: 15, country: 'UK', title: 'fifth', lat:51.58, lon:0},
{id: 5, date: '2011-06-02', x: 6, y: 12, z: 18, country: 'DE', title: 'sixth', lat:51.04, lon:7.9}
{id: 0, date: '2011-01-01', x: 1, y: 2, z: 3, p: '4%', country: 'DE', title: 'first', lat:52.56, lon:13.40},
{id: 1, date: '2011-02-02', x: 2, y: 4, z: 24, p: '14%',country: 'UK', title: 'second', lat:54.97, lon:-1.60},
{id: 2, date: '2011-03-03', x: 3, y: 6, z: 9, p: '43%', country: 'US', title: 'third', lat:40.00, lon:-75.5},
{id: 3, date: '2011-04-04', x: 4, y: 8, z: 6, p: '21%', country: 'UK', title: 'fourth', lat:57.27, lon:-6.20},
{id: 4, date: '2011-05-04', x: 5, y: 10, z: 15, p: '29%', country: 'UK', title: 'fifth', lat:51.58, lon:0},
{id: 5, date: '2011-06-02', x: 6, y: 12, z: 18, p: '87%', country: 'DE', title: 'sixth', lat:51.04, lon:7.9}
];
var dataset = new recline.Model.Dataset({records: documents, fields: fields});
return dataset;

View File

@ -55,6 +55,27 @@ test('dates in graph view', function () {
view.remove();
});
test('percentages in graph view', function () {
var dataset = Fixture.getDataset();
var view = new recline.View.Flot({
model: dataset,
state: {
'graphType': 'lines',
'group': 'country',
'series': ['p']
}
});
view.render();
$('.fixtures').append(view.el);
view.redraw();
var graphData = view.plot.getData()[0].data;
$.each(graphData, function(i, p){
var percentage = p[1];
equal($.isNumeric(percentage), true);
});
view.remove();
});
test('FlotControls basics', function () {
var dataset = Fixture.getDataset();
var view = new recline.View.FlotControls({

View File

@ -27,7 +27,7 @@ test('state', function () {
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}
@ -71,7 +71,7 @@ test('editable', function () {
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}
@ -108,7 +108,7 @@ test('delete-row' , function(){
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}
@ -154,7 +154,7 @@ test('delete-row-with-row-reorder-activated' , function(){
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}
@ -197,7 +197,7 @@ var dataset = Fixture.getDataset();
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}
@ -226,7 +226,7 @@ test('update', function() {
var view = new recline.View.SlickGrid({
model: dataset,
state: {
hiddenColumns:['x','lat','title'],
hiddenColumns:['x','lat','title','p'],
columnsOrder:['lon','id','z','date', 'y', 'country'],
columnsWidth:[
{column:'id',width: 250}