<commit_before>import test from 'tape';
import vcharts from '../src';

test('chart - basic - width and height should be based on el properties', t => {
  t.plan(2);

  const padding = {
    top: 10,
    left: 20,
    bottom: 30,
    right: 40
  };

  vcharts.templates.test = {
    width: ['@get', 'width', 100],
    height: ['@get', 'height', 200],
    padding: padding
  };

  let c = vcharts.chart('test', {
    el: {offsetWidth: 0, offsetHeight: 0}
  });

  t.deepEqual({
    width: 100,
    height: 200,
    padding: padding
  }, c.spec);

  c = vcharts.chart('test', {
    el: {offsetWidth: 300, offsetHeight: 400}
  });

  t.deepEqual({
    width: (300 - 20 - 40),
    height: (400 - 10 - 30),
    padding: padding
  }, c.spec);

  t.end();
});

test('vega - should produce vega spec', t => {
  let c = vcharts.chart('vega', {
    el: {},
    spec: {marks: []}
  });

  t.deepEqual(vcharts.templates.vega, c.template);
  t.deepEqual({marks: []}, c.spec);

  t.end();
});

test('update - should update options', function () {
  var c = vcharts.chart('vega', {
    el: {},
    spec: {marks: [1]}
  });

  assert.deepEqual(vcharts.templates.vega, c.template);
  assert.deepEqual({el: {}, spec: {marks: [1]}}, c.options);

  c.update({spec: {marks: [1, 2, 3]}});

  assert.deepEqual({el: {}, spec: {marks: [1, 2, 3]}}, c.options);
});<commit_msg>Use actual divs in vcharts tests<commit_after>import test from 'tape';
import vcharts from '../src';

test('chart - basic - width and height should be based on el properties', t => {
  t.plan(2);

  const padding = {
    top: 10,
    left: 20,
    bottom: 30,
    right: 40
  };

  vcharts.templates.test = {
    width: ['@get', 'width', 100],
    height: ['@get', 'height', 200],
    padding: padding
  };

  let c = vcharts.chart('test', {
    el: {offsetWidth: 0, offsetHeight: 0}
  });

  t.deepEqual({
    width: 100,
    height: 200,
    padding: padding
  }, c.spec);

  c = vcharts.chart('test', {
    el: {offsetWidth: 300, offsetHeight: 400}
  });

  t.deepEqual({
    width: (300 - 20 - 40),
    height: (400 - 10 - 30),
    padding: padding
  }, c.spec);

  t.end();
});

test('vega - should produce vega spec', t => {
  let c = vcharts.chart('vega', {
    el: document.createElement('div'),
    spec: {marks: []}
  });

  t.deepEqual(vcharts.templates.vega, c.template);
  t.deepEqual({marks: []}, c.spec);

  t.end();
});

test('update - should update options', function () {
  var c = vcharts.chart('vega', {
    el: document.createElement('div')
    spec: {marks: [1]}
  });

  assert.deepEqual(vcharts.templates.vega, c.template);
  assert.deepEqual({el: {}, spec: {marks: [1]}}, c.options);

  c.update({spec: {marks: [1, 2, 3]}});

  assert.deepEqual({el: {}, spec: {marks: [1, 2, 3]}}, c.options);
});
{'fraction_non_alphanumeric': 0.20613718411552345, 'fraction_numerical': 0.0368231046931408, 'mean_word_length': 2.9360795454545454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1650885', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1005, 'n_words': 259}