https://github.com/plotly/plotly.js
Raw File
Tip revision: 6077a3f59488826c75d389e65c1f248cc1c9de81 authored by Mojtaba Samimi on 22 May 2024, 14:04:23 UTC
voila
Tip revision: 6077a3f
test_plain_obj.js
var plotlyNode = require('./util/plotly_node');
var Plotly = plotlyNode('build/plotly.js');

var assertValidate = function(fig, exp) {
    console.log(fig);

    var errorList = Plotly.validate(fig.data, fig.layout);

    if(exp) {
        if(errorList !== undefined) throw 'should be valid:';
    } else {
        if(errorList === undefined) throw 'should not be valid:';
    }
};

assertValidate({
    data: [{ y: [1] }],
    layout: {}
}, true);

assertValidate({
    data: [{ z: false }],
    layout: {}
}, false);
back to top