Simple library for handling different css states and properties. Made for testing css related things with mocha or something like this.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests
.eslintignore
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.js
karma.conf.js
package.json

README.md

CSState

Simple dynamic CSS style handling tool.

Donate Build Status Coveralls npm version license Standard - JavaScript Style Guide

Installation

npm i --save-dev csstate

Usage

  var CSSTate = require('csstate');
  var cst = new CSSTate();

  cst.rule({
    'body': {
      'font-size': '18px'
    }
  });

  cst.exit();

Check out How to test DOM elements with CSSTate tutorial.

Features

Create/modify rules

rule(selector, property, value)

rule(object)

Remove rules

remove(selector)

remove(selector, proprery)

remove(object) - remove specified properties

remove(object, true) - remove by selectors, executes remove(selector) for each selector inside of the object.

Remove stylesheet

exit()

Usage in tests

  beforeEach(() => {
    cst.rule(defaultRules); // Load default rules
  });

  afterEach(() => {
    cst.exit(); // Remove entire stylesheet
  });

See the example.

License

MIT (c) 2017 Svetlana Linuxenko