How to use the @xviz/parser.Stylesheet function in @xviz/parser

To help you get started, we’ve selected a few @xviz/parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / xviz / test / modules / parser / styles / xviz-style-parser.spec.js View on Github external
tape('XVIZStyleParser#Stylesheet#getPropertyDefault', t => {
  let stylesheet = new Stylesheet();
  t.is(stylesheet.getPropertyDefault('radius'), 1, 'gets correct radius');
  t.deepEquals(
    stylesheet.getPropertyDefault('fill_color'),
    [255, 255, 255],
    'gets correct fill color'
  );
  t.deepEquals(
    stylesheet.getPropertyDefault('point_color_domain'),
    [0, 0],
    'gets correct point color domain'
  );

  stylesheet = new Stylesheet([
    {
      style: {point_color_mode: 'elevation'}
    }
  ]);
  t.deepEquals(
    stylesheet.getPropertyDefault('point_color_domain'),
    [0, 3],
    'gets correct point color domain'
  );

  t.end();
});
github uber / xviz / test / modules / parser / styles / xviz-style-parser.spec.js View on Github external
tape('XVIZStyleParser#Stylesheet', t => {
  for (const testData of TEST_STYLESHEETS) {
    t.comment(testData.title);
    const stylesheet = new Stylesheet(testData.stylesheet);

    t.ok(stylesheet, 'Stylesheet constructor does not throw error');
    t.is(stylesheet.getPropertyDefault('opacity'), 1, 'returns default property value');

    GET_PROPERTY_TEST_CASES.forEach(testCase => {
      t.deepEquals(
        stylesheet.getProperty(testCase.propertyName, testCase.state),
        testCase.output,
        'getProperty returns correct value'
      );
    });

    GET_DEPS_TEST_CASES.forEach(testCase => {
      t.deepEquals(
        stylesheet.getPropertyDependencies(testCase.propertyName),
        testCase.output,
github uber / xviz / test / modules / parser / styles / xviz-style-parser.spec.js View on Github external
tape('XVIZStyleParser#Stylesheet#getPropertyDefault', t => {
  let stylesheet = new Stylesheet();
  t.is(stylesheet.getPropertyDefault('radius'), 1, 'gets correct radius');
  t.deepEquals(
    stylesheet.getPropertyDefault('fill_color'),
    [255, 255, 255],
    'gets correct fill color'
  );
  t.deepEquals(
    stylesheet.getPropertyDefault('point_color_domain'),
    [0, 0],
    'gets correct point color domain'
  );

  stylesheet = new Stylesheet([
    {
      style: {point_color_mode: 'elevation'}
    }