<commit_before>/* tslint:disable quote */

import {assert} from 'chai';
import {parseModel} from '../util';
import {extend} from '../../src/util';
import {text} from '../../src/compile/mark-text';
import {X, Y} from '../../src/channel';

describe('Mark: Text', function() {
  it('should return correct marktype', function() {
    assert.equal(text.markType(), 'text');
  });

  describe('with nothing', function() {
    let spec = {
      "mark": "text",
      "encoding": {},
      "data": {"url": "data/cars.json"}
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should have placeholder text', function() {
      assert.deepEqual(props.text, {value: "Abc"});
    });
  });

  describe('with quantitative and format', function() {
    let spec = {
      "mark": "text",
      "encoding": {
        "text": {"field": "foo", "type": "quantitative"}
      },
      "config": {
        "mark": {
          "format": "d"
        }
      }
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should use number template', function() {
      assert.deepEqual(props.text, {template: '{{datum.foo | number:\'d\'}}'});
    });
  });

  describe('with temporal', function() {
    let spec = {
      "mark": "text",
      "encoding": {
        "text": {"field": "foo", "type": "temporal"}
      }
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should use dtae template', function() {
      assert.deepEqual(props.text, {template: '{{datum.foo | time:\'%Y-%m-%d\'}}'});
    });
  });

  describe('with x, y, text (ordinal)', function() {
    let spec = {
      "mark": "text",
      "encoding": {
        "x": {"field": "Acceleration", "type": "ordinal"},
        "y": {"field": "Displacement", "type": "quantitative"},
        "text": {"field": "Origin", "type": "ordinal"},
      },
      "data": {"url": "data/cars.json"}
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should scale on x', function() {
      assert.deepEqual(props.x, {scale: X, field: 'Acceleration'});
    });
    it('should scale on y', function(){
      assert.deepEqual(props.y, {scale: Y, field: 'Displacement'});
    });

    it('should be centered', function() {
      assert.deepEqual(props.align, {value: "center"});
    });<commit_msg>Use const in test<commit_after>/* tslint:disable quote */

import {assert} from 'chai';
import {parseModel} from '../util';
import {extend} from '../../src/util';
import {text} from '../../src/compile/mark-text';
import {X, Y} from '../../src/channel';

describe('Mark: Text', function() {
  it('should return correct marktype', function() {
    assert.equal(text.markType(), 'text');
  });

  describe('with nothing', function() {
    const spec = {
      "mark": "text",
      "encoding": {},
      "data": {"url": "data/cars.json"}
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should have placeholder text', function() {
      assert.deepEqual(props.text, {value: "Abc"});
    });
  });

  describe('with quantitative and format', function() {
    const spec = {
      "mark": "text",
      "encoding": {
        "text": {"field": "foo", "type": "quantitative"}
      },
      "config": {
        "mark": {
          "format": "d"
        }
      }
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should use number template', function() {
      assert.deepEqual(props.text, {template: '{{datum.foo | number:\'d\'}}'});
    });
  });

  describe('with temporal', function() {
    const spec = {
      "mark": "text",
      "encoding": {
        "text": {"field": "foo", "type": "temporal"}
      }
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should use date template', function() {
      assert.deepEqual(props.text, {template: '{{datum.foo | time:\'%Y-%m-%d\'}}'});
    });
  });

  describe('with x, y, text (ordinal)', function() {
    const spec = {
      "mark": "text",
      "encoding": {
        "x": {"field": "Acceleration", "type": "ordinal"},
        "y": {"field": "Displacement", "type": "quantitative"},
        "text": {"field": "Origin", "type": "ordinal"},
      },
      "data": {"url": "data/cars.json"}
    };
    const model = parseModel(spec);
    const props = text.properties(model);

    it('should scale on x', function() {
      assert.deepEqual(props.x, {scale: X, field: 'Acceleration'});
    });
    it('should scale on y', function(){
      assert.deepEqual(props.y, {scale: Y, field: 'Displacement'});
    });

    it('should be centered', function() {
      assert.deepEqual(props.align, {value: "center"});
    });
{'fraction_non_alphanumeric': 0.21213389121338913, 'fraction_numerical': 0.0, 'mean_word_length': 2.7705047318611986, 'pattern_counts': {'":': 60, '<': 3, '<?xml version=': 0, '>': 3, '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': '5371661', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1485, 'n_words': 369}