Adds DOM fixture support for Chai
Supports: Mocha, Jasmine, QUnit and possibly others. If your favourite test framework doesn't work please file an issue.
npm install chai-fixture
bower install chai-fixture
<script src="https://cdn.rawgit.com/isisbusapps/chai-fixture/master/chai-fixture.js"></script>
Note: Requires document
to exists. (I recommend using PhantomJS or similar)
var chai = require('chai');
var chaiFixture = require('chai-fixture');
chai.use(chaiFixture);
// Access fixture element
chai.fixture.setAttribute('background-color', 'red');
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/chai-fixture/chai-fixture.js"></script>
<script>
chai.use(chaiFixture);
// Access fixture element
chai.fixture.setAttribute('background-color', 'red');
</script>