Skip to content

Instantly share code, notes, and snippets.

export default function(ComposedComponent) {
let displayName = ComposedComponent.displayName || ComposedComponent.name;
@nuclearComponent({
formState: FormGetters.formState,
formValidation: FormGetters.formValidation
})
@provideContextDec({
Actions: PropTypes.object.isRequired,
formId: PropTypes.string.isRequired
var checkComplexPassword = function(password) {
var CHAR_LOWERS = /[a-z]/,
CHAR_UPPERS = /[A-Z]/,
CHAR_NUMBERS = /[0-9]/,
CHAR_SPECIAL = /[?=.*!@#$%^&*]/,
CHAR_TYPES = [CHAR_LOWERS,CHAR_UPPERS,CHAR_NUMBERS,CHAR_SPECIAL],
counter = 4;
for (var i=0; i<CHAR_TYPES.length; i++){
if(!CHAR_TYPES[i].test(password)){
let mockNuclearDec = mockNuclearComponent({formState, formValidation});
HigherOrderInput.__Rewire__('nuclearComponent', mockNuclearDec);
let HigherOrderComponent = HigherOrderInput(Input);
let hoc = TestUtils.renderIntoDocument(
<HigherOrderComponent {...mockProps} />
);
let hocElm = React.findDOMNode(hoc);
let inputObj = TestUtils.findRenderedDOMComponentWithClass(hoc, 'one');
//input type => Array
var exInput = [
{
name: 'first_name',
type: 'text',
value: 'burritos',
validation: {
customType: 'email',
conditions: /stuff/
}
@dtothefp
dtothefp / tree.sh
Last active August 29, 2015 14:27
▶ tree -h --dirsfirst ./js
./js
├── [ 680] common-modules
│   ├── [ 510] auth
│   │   ├── [ 12K] api.js
│   │   ├── [ 763] constants.js
│   │   ├── [6.3K] donation-history.js
│   │   ├── [2.4K] facebook.js
│   │   ├── [2.3K] google.js
│   │   ├── [ 623] index.js
import React, {Component, PropTypes} from 'react';
import {provideReactor} from 'nuclear-js-react-addons';
import cx from 'classnames';
import Form from './form';
import Input from './form-input';
import Label from './form-label';
@provideReactor({
Actions: PropTypes.object.isRequired
})
@dtothefp
dtothefp / store.js
Last active February 23, 2018 01:02
import { Store, toImmutable } from 'nuclear-js';
import {OPEN, CLOSE} from './modal-constants';
export const isOpenStore = Store({
getInitialState() {
return false;
},
initialize() {
// Sets isOpen to true
#### spec
function testCanCompleteInformationForm(){
return client.waitForVisible('#id_phone', 2000).then(() => {
return client.setValue('#id_donate_givenName', 'First')
.setValue('#id_donate_familyName', 'Last')
.setValue('#id_donate_address1', 'Address 1')
.setValue('#id_donate_city', 'City')
.selectByValue('#id_donate_state', 'NY')
.setValue('#id_donate_zip', '11201')
.setValue('#id_donate_email', 'info@hillaryclinton.com')
###############Speaking Points#####################
- our current eslint config and relation to Gulp and Webpack
- 'use-strict' and babel
- suggested rules https://docs.google.com/spreadsheets/d/1n_6MLaKUOJ1An-VCLHMuoTP1RZfhRsXQoVQArQRFYTA/edit#gid=0
- variable decalaration, hoising, block scoping
- comments for specific rules in files, i.e. /*global google*/ => const google = window.google
- a couple cool rules
- http://eslint.org/docs/rules/one-var
- ahhhhh...there's so many https://github.com/airbnb/javascript/blob/master/linters/.eslintrc
- process
import {join} from 'path';
import webpack from 'webpack';
import {merge} from 'lodash';
import WebpackDevServer from 'webpack-dev-server';
import makeConfig from './make-config';
export default function(gulp, plugins, config) {
var {ENV, site, port} = config;
var {gutil, browserSync} = plugins;
const isDev = ENV === 'DEV';