Updated CSS typed definition unit tests

This commit is contained in:
Ilya Verbitskiy 2015-11-19 22:03:38 -06:00
parent c4a1b81320
commit 8f31d962dc

View File

@ -1,6 +1,9 @@
/// <reference path="./css.d.ts" />
import css = require("css");
// Check that user can parse, modify and persist CSS content
var parserOptions: css.ParserOptions;
parserOptions = {
silent: true,
@ -23,4 +26,37 @@ stringifyOptions = {
};
var content = css.stringify(stylesheet, stringifyOptions);
console.log(content);
// Create new stylesheet and save it
var bgDeclaration: css.Declaration = {
type: "declaration",
property: "background",
value: "#eee"
};
var colorDeclaration: css.Declaration = {
type: "declaration",
property: "color",
value: "#888"
};
var ruleComment: css.Comment = {
type: "comment",
comment: "New CSS AST Tree Rule"
};
var bodyRule: css.Rule = {
type: "rule",
selectors: ["body"],
declarations: [ruleComment, bgDeclaration, colorDeclaration]
};
var newStylesheet: css.Stylesheet = {
type: "stylesheet",
stylesheet: {
rules: [bodyRule]
}
};
content = css.stringify(newStylesheet);