jasmine-enzyme
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -48,2 +48,6 @@ 'use strict'; | ||
var _toHaveStyle = require('./assertions/toHaveStyle'); | ||
var _toHaveStyle2 = _interopRequireDefault(_toHaveStyle); | ||
var _toHaveTagName = require('./assertions/toHaveTagName'); | ||
@@ -63,2 +67,9 @@ | ||
/** | ||
* This source code is licensed under the MIT-style license found in the | ||
* LICENSE file in the root directory of this source tree. * | ||
* | ||
* @providesModule JasmineEnzyme | ||
*/ | ||
function jasmineEnzyme() { | ||
@@ -75,12 +86,7 @@ jasmine.addMatchers(_toBeChecked2.default); | ||
jasmine.addMatchers(_toHaveState2.default); | ||
jasmine.addMatchers(_toHaveStyle2.default); | ||
jasmine.addMatchers(_toHaveTagName2.default); | ||
jasmine.addMatchers(_toHaveValue2.default); | ||
jasmine.addMatchers(_toMatch2.default); | ||
} /** | ||
* This source code is licensed under the MIT-style license found in the | ||
* LICENSE file in the root directory of this source tree. * | ||
* | ||
* @providesModule JasmineEnzyme | ||
*/ | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "jasmine-enzyme", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Jasmine assertions for enzyme", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -28,2 +28,3 @@ # jasmine-enzyme | ||
1. [toHaveState()](#tohavestatestatekeystring-statevalueany) | ||
1. [toHaveStyle()](#tohavestylestylekeystring-stylevalueany) | ||
1. [toHaveTagName()](#tohavetagnametagnamestring) | ||
@@ -59,3 +60,3 @@ 1. [toHaveValue()](#tohavevaluevalueany) | ||
"jest": { | ||
"setupTestFrameworkScriptFile": "node_modules/jasmine-enzyme/jest", | ||
"setupTestFrameworkScriptFile": "node_modules/jasmine-enzyme/lib/jest", | ||
} | ||
@@ -371,2 +372,29 @@ ``` | ||
#### `toHaveStyle(styleKey:string[, styleValue:?any])` | ||
| render | mount | shallow | | ||
| -------|-------|-------- | | ||
| no | yes | yes | | ||
Assert that the component has style of the provided key and value: | ||
```js | ||
function Fixture() { | ||
const style1 = { height: '100%' }; | ||
const style2 = { flex: 8 }; | ||
return ( | ||
<div> | ||
<span id="style1" style={style1} /> | ||
<span id="style2" style={style2} /> | ||
</div> | ||
); | ||
} | ||
const wrapper = mount(<Fixture />); // mount/render/shallow when applicable | ||
expect(wrapper.find('#style1')).toHaveStyle('height', '100%'); | ||
expect(wrapper.find('#style2')).toHaveStyle('flex', 8); | ||
``` | ||
#### `toHaveTagName(tagName:string)` | ||
@@ -373,0 +401,0 @@ |
@@ -18,2 +18,3 @@ /** | ||
import toHaveState from './assertions/toHaveState'; | ||
import toHaveStyle from './assertions/toHaveStyle'; | ||
import toHaveTagName from './assertions/toHaveTagName'; | ||
@@ -34,2 +35,3 @@ import toHaveValue from './assertions/toHaveValue'; | ||
jasmine.addMatchers(toHaveState); | ||
jasmine.addMatchers(toHaveStyle); | ||
jasmine.addMatchers(toHaveTagName); | ||
@@ -36,0 +38,0 @@ jasmine.addMatchers(toHaveValue); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55334
50
1336
510