rofrischmann/elodin

View on GitHub
core/parser/src/__tests__/__snapshots__/Parser-test.js.snap

Summary

Maintainability
Test Coverage
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Parsing elodin syntax should correctly parse comments 1`] = `
Object {
  "body": Array [
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "type": "Identifier",
          "value": "Bar",
        },
        Object {
          "comments": Array [
            " baz",
          ],
          "type": "Identifier",
          "value": "Foo",
        },
      ],
      "comments": Array [
        " variant comment",
      ],
      "name": "Foo",
      "type": "Variant",
    },
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "backgroundColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "red",
          },
        },
        Object {
          "comments": Array [
            " inline",
          ],
          "dynamic": false,
          "property": "borderColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "callee": "rgb",
            "params": Array [
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
            ],
            "type": "FunctionExpression",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "paddingLeft",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "negative": false,
            "type": "Integer",
            "value": 15,
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "marginTop",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "fractional": 2,
            "integer": 1,
            "negative": false,
            "type": "Float",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": true,
          "property": "borderWidth",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "environment": false,
            "type": "Variable",
            "value": "width",
          },
        },
        Object {
          "comments": Array [
            " another",
          ],
          "dynamic": false,
          "property": "animationName",
          "raw": true,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "keyframe",
          },
        },
      ],
      "comments": Array [
        " A comment",
        " Another one",
      ],
      "name": "Button",
      "type": "Style",
    },
  ],
  "type": "File",
}
`;

exports[`Parsing elodin syntax should correctly parse conditionals 1`] = `
Object {
  "body": Array [
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "type": "Identifier",
          "value": "Dark",
        },
        Object {
          "comments": Array [],
          "type": "Identifier",
          "value": "Light",
        },
      ],
      "comments": Array [],
      "name": "Mode",
      "type": "Variant",
    },
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "backgroundColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "red",
          },
        },
        Object {
          "body": Array [
            Object {
              "comments": Array [],
              "dynamic": false,
              "property": "backgroundColor",
              "raw": false,
              "type": "Declaration",
              "value": Object {
                "type": "Identifier",
                "value": "blue",
              },
            },
          ],
          "comments": Array [],
          "operator": "=",
          "property": Object {
            "type": "Identifier",
            "value": "Mode",
          },
          "type": "Conditional",
          "value": Object {
            "type": "Identifier",
            "value": "Dark",
          },
        },
      ],
      "comments": Array [],
      "name": "Button",
      "type": "Style",
    },
  ],
  "type": "File",
}
`;

exports[`Parsing elodin syntax should correctly parse env condition 1`] = `
Object {
  "body": Array [
    Object {
      "body": Array [
        Object {
          "body": Array [
            Object {
              "comments": Array [],
              "dynamic": false,
              "property": "backgroundColor",
              "raw": false,
              "type": "Declaration",
              "value": Object {
                "type": "Identifier",
                "value": "red",
              },
            },
          ],
          "boolean": true,
          "comments": Array [],
          "property": Object {
            "environment": true,
            "type": "Variable",
            "value": "hover",
          },
          "type": "Conditional",
        },
        Object {
          "body": Array [
            Object {
              "comments": Array [],
              "dynamic": false,
              "property": "backgroundColor",
              "raw": false,
              "type": "Declaration",
              "value": Object {
                "type": "Identifier",
                "value": "blue",
              },
            },
            Object {
              "body": Array [
                Object {
                  "comments": Array [],
                  "dynamic": false,
                  "property": "backgroundColor",
                  "raw": false,
                  "type": "Declaration",
                  "value": Object {
                    "type": "Identifier",
                    "value": "green",
                  },
                },
              ],
              "boolean": true,
              "comments": Array [],
              "property": Object {
                "environment": true,
                "type": "Variable",
                "value": "hover",
              },
              "type": "Conditional",
            },
          ],
          "comments": Array [],
          "operator": ">=",
          "property": Object {
            "environment": true,
            "type": "Variable",
            "value": "viewportWidth",
          },
          "type": "Conditional",
          "value": Object {
            "negative": false,
            "type": "Integer",
            "value": 320,
          },
        },
      ],
      "comments": Array [],
      "name": "Button",
      "type": "Style",
    },
  ],
  "type": "File",
}
`;

exports[`Parsing elodin syntax should correctly parse multiple styles 1`] = `
Object {
  "body": Array [
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "backgroundColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "red",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "paddingLeft",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "negative": false,
            "type": "Integer",
            "value": 10,
          },
        },
      ],
      "comments": Array [],
      "name": "Button",
      "type": "Style",
    },
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "lineHeight",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "negative": false,
            "type": "Integer",
            "value": 2,
          },
        },
      ],
      "comments": Array [],
      "name": "Label",
      "type": "Style",
    },
  ],
  "type": "File",
}
`;

exports[`Parsing elodin syntax should correctly parse styles 1`] = `
Object {
  "body": Array [
    Object {
      "body": Array [
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "backgroundColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "red",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "borderColor",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "callee": "rgb",
            "params": Array [
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
              Object {
                "negative": false,
                "type": "Integer",
                "value": 255,
              },
            ],
            "type": "FunctionExpression",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "paddingLeft",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "negative": false,
            "type": "Integer",
            "value": 15,
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "marginTop",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "fractional": 2,
            "integer": 1,
            "negative": false,
            "type": "Float",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": true,
          "property": "borderWidth",
          "raw": false,
          "type": "Declaration",
          "value": Object {
            "environment": false,
            "type": "Variable",
            "value": "width",
          },
        },
        Object {
          "comments": Array [],
          "dynamic": false,
          "property": "animationName",
          "raw": true,
          "type": "Declaration",
          "value": Object {
            "type": "Identifier",
            "value": "keyframe",
          },
        },
      ],
      "comments": Array [],
      "name": "Button",
      "type": "Style",
    },
  ],
  "type": "File",
}
`;