diff --git a/enzyme.md b/enzyme.md new file mode 100644 index 000000000..eb4c30ce5 --- /dev/null +++ b/enzyme.md @@ -0,0 +1,84 @@ +--- +title: Enzyme +category: React +--- + +## ReactWrapper + +```js +wrap = shallow() // => ReactWrapper (shallow) +wrap = mount() // => ReactWrapper (full) +``` + +### Traversing + +```js +wrap.find('button') // => ReactWrapper +wrap.filter('button') // => ReactWrapper +wrap.not('span') // => ReactWrapper (inverse of filter()) +wrap.children() // => ReactWrapper +wrap.parent() // => ReactWrapper +wrap.closest('div') // => ReactWrapper +wrap.childAt(0) // => ReactWrapper +wrap.at(0) // => ReactWrapper +wrap.first() // => ReactWrapper +wrap.last() // => ReactWrapper +``` + +```js +wrap.get(0) // => ReactElement +wrap.getNode() // => ReactElement +wrap.getNodes() // => Array +wrap.getDOMNode() // => DOMComponent +``` + +### Actions + +```js +wrap.simulate('click') +``` + +### React components + +```js +wrap.setState({ ... }) +wrap.setProps({ ... }) +wrap.setContext({ ... }) + +wrap.state() // => Any (get state) +wrap.props() // => object (get props) +wrap.context() // => Any (get context) + +wrap.instance() // => ReactComponent +``` + +### Mount + +```js +wrap.mount() +wrap.unmount() +wrap.update() // calls forceUpdate() +``` + +### Tests + +```js +wrap.debug() // => string +wrap.html() // => string +wrap.text() // => string +wrap.type() // => string | function +wrap.name() // => string +wrap.is('.classname') // => boolean +wrap.hasClass('class') // => boolean +wrap.exists() // => boolean +wrap.contains(
) // => boolean +wrap.contains([
]) // => boolean + +wrap.containsMatchingElement(
) // => boolean +wrap.containsAllMatchingElements([
]) // => boolean +wrap.containsAnyMatchingElements([
]) // => boolean +``` + +## References + +- diff --git a/html-meta.md b/html-meta.md index 58ac0daef..443cac75e 100644 --- a/html-meta.md +++ b/html-meta.md @@ -57,27 +57,58 @@ article:section article:tag ``` -### Favicon - -```html - -``` - -### Web app - -```html - - - -``` - ### Apple-only ```html - + ``` +## Progressive web apps + +### Add to homescreen + +```html + + + +``` + +### [Theme color](https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android) + +```html + +``` + +### [Manifest](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/) + +```html + +``` + +### [Icons](https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/) + +```html + + + + + + + + + + + + + + + + +``` + +Chrome on Android recommends [192x192](https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android). + ### Reference - * https://dev.twitter.com/docs/cards - * https://developers.facebook.com/docs/opengraphprotocol/#types + * + *