karma-jasmine-dom
v1.0.1
Published
Set of 19 jasmine custom matchers configured for karma to test html DOM.
Downloads
545
Maintainers
Readme
Description
karma-jasmine-dom
adapts the jasmine-dom-custom-matchers
package to the karma
framework.
- All the available matchers are described in the
jasmine-dom-custom-matchers
documentation - See also
karma-html
to test html files in the browser withkarma
[link]
Usage
- Run
npm install karma-jasmine-dom
- Add the following frameworks into your
karma.conf.js
file:
module.exports = function(config) {
config.set({
//karma config here
frameworks: ['jasmine-dom','jasmine']
});
};
Mind that
jasmine-dom
must precedejasmine
(as above) in theframeworks
array. The frameworks are loaded from right to left and thejasmine
must be loaded first, as thejasmine-dom
arejasmine
custom matchers.
Tests
Load the matchers with jasmine.addMatchers
native method:
describe("The <body>",function(){
beforeAll(function(){
jasmine.addMatchers(DOMCustomMatchers);
});
it("should be the part of DOM",function(){
expect(document.body).toBeDocumentNode();
});
});