Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v
on the command line.
$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
In addition to the Storybook for React setup, you'll also need to install these packages:
npm i -D @babel/core babel-loader css-loader style-loader
A few of the Enzyme examples show using a class method of a component, but instead of using the instance()
function to get the class instance and test the method's return value, instead they simulate events, then check the side effects of those events called from the method you want to test.
In the below example, unit test coverage will say the Failure
part of the onNameBlur
method was covered.
class AddUserForm extends React.Component {
from .common import * # noqa | |
DEBUG = True | |
INSTALLED_APPS += ('django_extensions',) | |
# Snip all the other stuff |
# Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
# Original author: udfalkso | |
# Modified by: Shwagroo Team and Gun.io | |
# Further modified by: Jakub Skalecki (https://rock-it.pl) | |
import hotshot | |
import hotshot.stats | |
import textwrap | |
import os |
from django.db import models | |
from wagtail.wagtailsnippets.models import register_snippet | |
from wagtail.wagtailcore.models import Page | |
from modelcluster.fields import ParentalKey | |
from wagtail.wagtailadmin.edit_handlers import InlinePanel | |
@register_snippet | |
class Category(models.Model): |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.
Add the executable to your path and git will automatically expose it as
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react"], | |
"ecmaFeatures": { |