<commit_before>var tape = require("tape");
var jsdom = require("./jsdom");
var deepEqualData = require("./deepEqualData");
var d3 = require("d3-selection");
var d3_graphviz = require("../");
var stringify = require('json-stringify-safe');

tape("data extraction", function(test) {
    var window = global.window = jsdom('<div id="graph"></div>');
    var document = global.document = window.document;
    var graphviz = d3_graphviz.graphviz("#graph")
        .on('initEnd', () => {
            graphviz
                .zoom(false)
                .dot('digraph {a -> b;}');

            delete graphviz._data.parent;

            var actualData = graphviz._data;
            var expectedData = JSON.parse(JSON.stringify(basic_data))

            deepEqualData(test, actualData, expectedData, "Extracted data equals predefined data");

            graphviz.render();
            var svg = d3.select('svg');
            actualData = graphviz._extractData(svg, 0, null);
            var expectedData = JSON.parse(JSON.stringify(basic_data));
            deepEqualData(test, actualData, expectedData, "Explicitly extracted data equals predefined data");

            test.end();
        });
});

var basic_data = {
    "tag": "svg",
    "attributes": {
        "width": "62pt",
        "height": "116pt",
        "viewBox": "0.00 0.00 62.00 116.00",
        "xmlns": "http://www.w3.org/2000/svg",
        "xmlns:xlink": "http://www.w3.org/1999/xlink"
    },
    "children": [
        {
            "tag": "#text",
            "text": "\n",
            "attributes": {},
            "parent": "[Circular ~]",
            "children": [],
            "key": "#text-0",
            "id": "svg-0.#text-0"
        },
        {
            "tag": "g",
            "attributes": {
                "id": "graph0",
                "class": "graph",
                "transform": "scale(1 1) rotate(0) translate(4 112)"
            },
            "translation": {
                "x": 4,
                "y": 112
            },
            "scale": 1,
            "parent": "[Circular ~]",
            "children": [
                {
                    "tag": "#text",
                    "text": "\n",
                    "attributes": {},
                    "parent": "[Circular ~.children.1]",
                    "children": [],
                    "key": "#text-0",
                    "id": "svg-0.g-0.#text-0"
                },
                {
                    "tag": "polygon",
                    "attributes": {
                        "fill": "white",
                        "stroke": "transparent",
                        "points": "-4,4 -4,-112 58,-112 58,4 -4,4"
                    },
                    "bbox": {
                        "x": -4,
                        "y": -112,
                        "width": 62,
                        "height": 116
                    },
                    "center": {<commit_msg>adapt dot-data-test.js to Graphviz "transparent" to "none" change<commit_after>var tape = require("tape");
var jsdom = require("./jsdom");
var deepEqualData = require("./deepEqualData");
var d3 = require("d3-selection");
var d3_graphviz = require("../");
var stringify = require('json-stringify-safe');

tape("data extraction", function(test) {
    var window = global.window = jsdom('<div id="graph"></div>');
    var document = global.document = window.document;
    var graphviz = d3_graphviz.graphviz("#graph")
        .on('initEnd', () => {
            graphviz
                .zoom(false)
                .dot('digraph {a -> b;}');

            delete graphviz._data.parent;

            var actualData = graphviz._data;
            var expectedData = JSON.parse(JSON.stringify(basic_data))

            deepEqualData(test, actualData, expectedData, "Extracted data equals predefined data");

            graphviz.render();
            var svg = d3.select('svg');
            actualData = graphviz._extractData(svg, 0, null);
            var expectedData = JSON.parse(JSON.stringify(basic_data));
            deepEqualData(test, actualData, expectedData, "Explicitly extracted data equals predefined data");

            test.end();
        });
});

var basic_data = {
    "tag": "svg",
    "attributes": {
        "width": "62pt",
        "height": "116pt",
        "viewBox": "0.00 0.00 62.00 116.00",
        "xmlns": "http://www.w3.org/2000/svg",
        "xmlns:xlink": "http://www.w3.org/1999/xlink"
    },
    "children": [
        {
            "tag": "#text",
            "text": "\n",
            "attributes": {},
            "parent": "[Circular ~]",
            "children": [],
            "key": "#text-0",
            "id": "svg-0.#text-0"
        },
        {
            "tag": "g",
            "attributes": {
                "id": "graph0",
                "class": "graph",
                "transform": "scale(1 1) rotate(0) translate(4 112)"
            },
            "translation": {
                "x": 4,
                "y": 112
            },
            "scale": 1,
            "parent": "[Circular ~]",
            "children": [
                {
                    "tag": "#text",
                    "text": "\n",
                    "attributes": {},
                    "parent": "[Circular ~.children.1]",
                    "children": [],
                    "key": "#text-0",
                    "id": "svg-0.g-0.#text-0"
                },
                {
                    "tag": "polygon",
                    "attributes": {
                        "fill": "white",
                        "stroke": "none",
                        "points": "-4,4 -4,-112 58,-112 58,4 -4,4"
                    },
                    "bbox": {
                        "x": -4,
                        "y": -112,
                        "width": 62,
                        "height": 116
                    },
                    "center": {
{'fraction_non_alphanumeric': 0.16556739387789615, 'fraction_numerical': 0.027735498055132757, 'mean_word_length': 1.2702495201535509, 'pattern_counts': {'":': 88, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '198140', 'n_tokens_mistral': 1793, 'n_tokens_neox': 1625, 'n_words': 339}