augur-ui-react-components
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Augur UI React Components", | ||
@@ -19,3 +19,3 @@ "author": "Baz (@thinkloop)", | ||
"watch": "clear; echo \"* NPM UPDATE *\"; npm update; echo \"* CLEAN * HTML * ASSETS * CSS * WATCHIFY *\"; NODE_ENV=development; npm run -s watch:all", | ||
"build": "clear; echo \"* NPM UPDATE *\"; npm update; echo \"* * * * BUILD * * * *\"; NODE_ENV=production npm update && npm run -s build:all", | ||
"build": "clear; echo \"* NPM UPDATE *\"; npm update; echo \"* * * * BUILD * * * *\"; NODE_ENV=production npm run -s build:all", | ||
"lint": "clear; echo begin linting... && eslint --ext .jsx,.js src && echo linting complete.", | ||
@@ -73,6 +73,7 @@ "lint:watch": "npm run lint -- --watch", | ||
"mocha": "2.5.3", | ||
"moment": "^2.13.0", | ||
"npm-check-updates": "2.6.7", | ||
"onchange": "2.5.0", | ||
"react": "15.1.0", | ||
"react-date-picker": "4.x.x", | ||
"react-datetime": "^2.3.2", | ||
"react-dom": "15.1.0", | ||
@@ -79,0 +80,0 @@ "react-highcharts": "8.3.3", |
@@ -7,7 +7,8 @@ import React, { PropTypes } from 'react'; | ||
import Input from '../../common/components/input'; | ||
import DatePicker from 'react-date-picker'; | ||
import DatePicker from '../../common/components/datepicker'; | ||
const CreateMarketForm2 = (p) => { | ||
let typeSpecific; | ||
// const tomorrow = new Date(); | ||
// tomorrow.setDate(tomorrow.getDate() + 1); | ||
switch (p.type) { | ||
@@ -47,8 +48,4 @@ case CATEGORICAL: | ||
<DatePicker | ||
minDate={new Date()} | ||
date={p.endDate} | ||
hideFooter | ||
onChange={(dateText, dateMoment) => p.onValuesUpdated({ endDate: dateMoment.toDate() })} | ||
/> | ||
<DatePicker endDate={p.endDate} onValuesUpdated={p.onValuesUpdated} /> | ||
{p.errors.endDate && | ||
@@ -80,1 +77,2 @@ <span className="error-message">{p.errors.endDate}</span> | ||
export default CreateMarketForm2; | ||
// expanded={true} |
@@ -1,7 +0,217 @@ | ||
var assert = require('chai').assert; | ||
// createMarketForm: {} | ||
function createMarketFormAssertion(actual) { | ||
assert.isDefined(actual, `createMarketForm isn't defined`); | ||
assert.isObject(actual, `createMarketForm isn't an object`); | ||
import { assert } from 'chai'; | ||
import endDateShape from '../../test/assertions/common/endDateShape'; | ||
import initialFairPricesShape from '../../test/assertions/common/initialFairPricesShape'; | ||
import percentNumberShape from '../../test/assertions/common/percentNumberShape'; | ||
import numberShape from '../../test/assertions/common/numberShape'; | ||
export function step1(actual){ | ||
describe('augur-ui-react-components createMarketForm step-1 initial state', () => { | ||
it('should receive step and be a number', () => { | ||
assert.isDefined(actual.step, 'step is not defined'); | ||
assert.isNumber(actual.step, 'step is not a number'); | ||
}); | ||
it('should receive creatingMarket and be a boolean', () => { | ||
assert.isDefined(actual.creatingMarket, 'creatingMarket is not defined'); | ||
assert.isBoolean(actual.creatingMarket, 'creatingMarket is not a boolean'); | ||
}); | ||
it('should receive errors and be an object', () => { | ||
assert.isDefined(actual.errors, 'errors is not defined'); | ||
assert.isObject(actual.errors, 'errors is not an object'); | ||
}); | ||
it('should receive onValuesUpdated and be a function', () => { | ||
assert.isDefined(actual.onValuesUpdated, 'onValuesUpdated is not defined'); | ||
assert.isFunction(actual.onValuesUpdated, 'onValuesUpdated is not a function'); | ||
}); | ||
}); | ||
} | ||
module.exports = createMarketFormAssertion; | ||
export function step2(actual){ | ||
describe(`augur-ui-react-components createMarketForm step-2 ${actual.type} market initial state`, () => { | ||
it('should receive type and be a string', () => { | ||
assert.isDefined(actual.type, 'type is not defined'); | ||
assert.isString(actual.type, 'type is not a string'); | ||
}); | ||
it('should receive initialFairPrices and be an object with correct shape', () => { | ||
assert.isDefined(actual.initialFairPrices, 'initialFairPrices is not defined'); | ||
assert.isObject(actual.initialFairPrices, 'initialFairPrices is not an object'); | ||
initialFairPricesShape(actual.initialFairPrices); | ||
}); | ||
it('should receive descriptionPlaceholder and be a string', () => { | ||
assert.isDefined(actual.descriptionPlaceholder, 'descriptionPlaceholder is not defined'); | ||
assert.isString(actual.descriptionPlaceholder, 'descriptionPlaceholder is not a string'); | ||
}); | ||
it('should receive descriptionMaxLength and be a number', () => { | ||
assert.isDefined(actual.descriptionMaxLength, 'descriptionMaxLength is not defined'); | ||
assert.isNumber(actual.descriptionMaxLength, 'descriptionMaxLength is not a number'); | ||
}); | ||
switch(actual.type){ | ||
case 'categorical': | ||
it('should receive categoricalOutcomesMinNum and be a number', () => { | ||
assert.isDefined(actual.categoricalOutcomesMinNum, 'categoricalOutcomesMinNum is not defined'); | ||
assert.isNumber(actual.categoricalOutcomesMinNum, 'categoricalOutcomesMinNum is not a number'); | ||
}); | ||
it('should receive categoricalOutcomesMaxNum and be a number', () => { | ||
assert.isDefined(actual.categoricalOutcomesMaxNum, 'categoricalOutcomesMaxNum is not defined'); | ||
assert.isNumber(actual.categoricalOutcomesMaxNum, 'categoricalOutcomesMaxNum is not a number'); | ||
}); | ||
it('should receive categoricalOutcomeMaxLength and be a number', () => { | ||
assert.isDefined(actual.categoricalOutcomeMaxLength, 'categoricalOutcomeMaxLength is not defined'); | ||
assert.isNumber(actual.categoricalOutcomeMaxLength, 'categoricalOutcomeMaxLength is not a number'); | ||
}); | ||
break; | ||
case 'scalar': | ||
it('should receive scalarSmallNum and be a number', () => { | ||
assert.isDefined(actual.scalarSmallNum, 'scalarSmallNum is not defined'); | ||
assert.isNumber(actual.scalarSmallNum, 'scalarSmallNum is not a number'); | ||
}); | ||
it('should receive scalarBigNum and be a number', () => { | ||
assert.isDefined(actual.scalarBigNum, 'scalarBigNum is not defined'); | ||
assert.isNumber(actual.scalarBigNum, 'scalarBigNum is not a number'); | ||
}); | ||
break; | ||
} | ||
}); | ||
} | ||
export function step3(actual){ | ||
describe('augur-ui-react-components createMarketForm step-3 initial state', () => { | ||
it('should receive description and be a string', () => { | ||
assert.isDefined(actual.description, 'description is not defined'); | ||
assert.isString(actual.description, 'description is not a string'); | ||
}); | ||
it('should receive tagMaxNum and be a number', () => { | ||
assert.isDefined(actual.tagsMaxNum, 'tagsMaxNum is not defined'); | ||
assert.isNumber(actual.tagsMaxNum, 'tagsMaxNum is not a number'); | ||
}); | ||
it('should receive tagsMaxLength and be a number', () => { | ||
assert.isDefined(actual.tagMaxLength, 'tagsMaxLength is not defined'); | ||
assert.isNumber(actual.tagMaxLength, 'tagsMaxLength is not a number'); | ||
}); | ||
}); | ||
} | ||
export function step4(actual){ | ||
describe('augur-ui-react-components createMarketForm step-4 initial state', () => { | ||
it('should receive makerFee and be a number', () => { | ||
assert.isDefined(actual.makerFee, 'makerFee is not defined'); | ||
assert.isNumber(actual.makerFee, 'makerFee is not a number'); | ||
}); | ||
it('should receive initialLiquidity and be a number', () => { | ||
assert.isDefined(actual.initialLiquidity, 'initialLiquidity is not defined'); | ||
assert.isNumber(actual.initialLiquidity, 'initialLiquidity is not a number'); | ||
}); | ||
it('should receive initialFairPrices and be an object with correct shape', () => { | ||
assert.isDefined(actual.initialFairPrices, 'initialFairPrices is not defined'); | ||
assert.isObject(actual.initialFairPrices, 'initialFairPrices is not an object'); | ||
initialFairPricesShape(actual.initialFairPrices); | ||
}); | ||
it('should receive bestStartingQuantity and be a number', () => { | ||
assert.isDefined(actual.bestStartingQuantity, 'bestStartingQuantity is not defined'); | ||
assert.isNumber(actual.bestStartingQuantity, 'bestStartingQuantity is not a number'); | ||
}); | ||
it('should receive startingQuantity and be a number', () => { | ||
assert.isDefined(actual.startingQuantity, 'startingQuantity is not defined'); | ||
assert.isNumber(actual.startingQuantity, 'startingQuantity is not a number'); | ||
}); | ||
it('should receive priceWidth and be a number', () => { | ||
assert.isDefined(actual.priceWidth, 'priceWidth is not defined'); | ||
assert.isNumber(actual.priceWidth, 'priceWidth is not a number'); | ||
}); | ||
it('should receive priceDepth and be a number', () => { | ||
assert.isDefined(actual.priceDepth, 'priceDepth is not defined'); | ||
assert.isNumber(actual.priceDepth, 'priceDepth is not a number'); | ||
}); | ||
}); | ||
} | ||
export function step5(actual){ | ||
describe('augur-ui-react-components createMarketForm step-5 initial state', () => { | ||
it('should receive description and be a string', () => { | ||
assert.isDefined(actual.description, 'description is not defined'); | ||
assert.isString(actual.description, 'description is not a string'); | ||
}); | ||
it('should receive outcomes and be an array', () => { | ||
assert.isDefined(actual.outcomes, 'outcomes is not defined'); | ||
assert.isArray(actual.outcomes, 'outcomes is not an array'); | ||
}); | ||
it('should receive endDate and be an object with correct shape', () => { | ||
assert.isDefined(actual.endDate, 'endDate is not defined'); | ||
assert.isObject(actual.endDate, 'endDate is not an array'); | ||
endDateShape(actual.endDate); | ||
}); | ||
it('should receive tradingFeePercent and be an object with correct shape', () => { | ||
assert.isDefined(actual.tradingFeePercent, 'tradingFeePercent is not defined'); | ||
assert.isObject(actual.tradingFeePercent, 'tradingFeePercent is not an object'); | ||
percentNumberShape(actual.tradingFeePercent); | ||
}); | ||
it('should receive creatingMarket and be a boolean', () => { | ||
assert.isDefined(actual.creatingMarket, 'creatingMarket is not defined'); | ||
assert.isBoolean(actual.creatingMarket, 'creatingMarket is not a boolean'); | ||
}); | ||
it('should receive volume and be an object with correct shape', () => { | ||
assert.isDefined(actual.volume, 'volume is not defined'); | ||
assert.isObject(actual.volume, 'volume is not an object'); | ||
numberShape(actual.volume); | ||
}); | ||
it('should receive makerFeePercent and be an object with correct shape', () => { | ||
assert.isDefined(actual.makerFeePercent, 'makerFeePercent is not defined'); | ||
assert.isObject(actual.makerFeePercent, 'makerFeePercent is not an object'); | ||
percentNumberShape(actual.makerFeePercent); | ||
}); | ||
it('should receive takerFeePercent and be an object with correct shape', () => { | ||
assert.isDefined(actual.takerFeePercent, 'takerFeePercent is not defined'); | ||
assert.isObject(actual.takerFeePercent, 'takerFeePercent is not an object'); | ||
percentNumberShape(actual.takerFeePercent); | ||
}); | ||
it('should receive initialFairPrices and be an object with correct shape', () => { | ||
assert.isDefined(actual.initialFairPrices, 'initialFairPrices is not defined'); | ||
assert.isObject(actual.initialFairPrices, 'initialFairPrices is not an object'); | ||
initialFairPricesShape(actual.initialFairPrices); | ||
}); | ||
it('should receive bestStartingQuantityFormatted and be an object with correct shape', () => { | ||
assert.isDefined(actual.bestStartingQuantityFormatted, 'bestStartingQuantityFormatted is not defined'); | ||
assert.isObject(actual.bestStartingQuantityFormatted, 'bestStartingQuantityFormatted is not an object'); | ||
numberShape(actual.bestStartingQuantityFormatted); | ||
}); | ||
it('should receive startingQuantityFormatted and be an object with correct shape', () => { | ||
assert.isDefined(actual.startingQuantityFormatted, 'startingQuantityFormatted is not defined'); | ||
assert.isObject(actual.startingQuantityFormatted, 'startingQuantityFormatted is not an object'); | ||
numberShape(actual.startingQuantityFormatted); | ||
}); | ||
it('should receive priceWidthFormatted and be an object with correct shape', () => { | ||
assert.isDefined(actual.priceWidthFormatted, 'priceWidthFormatted is not defined'); | ||
assert.isObject(actual.priceWidthFormatted, 'priceWidthFormatted is not an object'); | ||
numberShape(actual.priceWidthFormatted); | ||
}); | ||
}); | ||
} |
var assert = require('chai').assert; | ||
import percentNumberShape from '../../test/assertions/common/percentNumberShape'; | ||
import numberShape from '../../test/assertions/common/numberShape'; | ||
// markets: | ||
@@ -39,7 +43,7 @@ // [ { id: String, | ||
assert.isObject(actual.tradingFeePercent, `market.tradingFeePercent isn't an object`); | ||
tradingFeePercentAssertion(actual.tradingFeePercent); | ||
percentNumberShape(actual.tradingFeePercent); | ||
assert.isDefined(actual.volume, `market.volume isn't defined`); | ||
assert.isObject(actual.volume, `market.volume isn't an object`); | ||
volumeAssertion(actual.volume); | ||
numberShape(actual.volume); | ||
@@ -81,62 +85,3 @@ assert.isDefined(actual.isOpen, `market.isOpen isn't defined`); | ||
} | ||
// tradingFeePercent: { | ||
// value: Number, | ||
// formattedValue: Number, | ||
// formatted: String, | ||
// roundedValue: Number, | ||
// rounded: String, | ||
// minimized: String, | ||
// denomination: String, | ||
// full: String | ||
// } | ||
function tradingFeePercentAssertion(actual) { | ||
assert.isDefined(actual, `market.tradingFeePercent doesn't exist`); | ||
assert.isObject(actual, `market.tradingFeePercent isn't an object`); | ||
assert.isDefined(actual.value, `tradingFeePercent.value isn't defined`); | ||
assert.isNumber(actual.value, `tradingFeePercent.value isn't a number`); | ||
assert.isDefined(actual.formattedValue, `tradingFeePercent.formattedValue isn't defined`); | ||
assert.isNumber(actual.formattedValue, `tradingFeePercent.formattedValue isn't a number`); | ||
assert.isDefined(actual.formatted, `tradingFeePercent.formatted isn't defined`); | ||
assert.isString(actual.formatted, `tradingFeePercent.formatted isn't a string`); | ||
assert.isDefined(actual.roundedValue, `tradingFeePercent.roundedValue isn't defined`); | ||
assert.isNumber(actual.roundedValue, `tradingFeePercent.roundedValue isn't a number`); | ||
assert.isDefined(actual.rounded, `tradingFeePercent.rounded isn't defined`); | ||
assert.isString(actual.rounded, `tradingFeePercent.rounded isn't a string`); | ||
assert.isDefined(actual.minimized, `tradingFeePercent.minimized isn't defined`); | ||
assert.isString(actual.minimized, `tradingFeePercent.minimized isn't a string`); | ||
assert.isDefined(actual.denomination, `tradingFeePercent.denomination isn't defined`); | ||
assert.isString(actual.denomination, `tradingFeePercent.denomination isn't a String`); | ||
assert.isDefined(actual.full, `tradingFeePercent.full isn't defined`); | ||
assert.isString(actual.full, `tradingFeePercent.full isn't a string`); | ||
} | ||
// volume: { | ||
// value: Number, | ||
// formattedValue: Number, | ||
// formatted: String, | ||
// roundedValue: Number, | ||
// rounded: String, | ||
// minimized: String, | ||
// denomination: String, | ||
// full: String | ||
// } | ||
function volumeAssertion(actual) { | ||
assert.isDefined(actual, `market.volume doesn't exist`); | ||
assert.isObject(actual, `market.volume isn't an object`); | ||
assert.isDefined(actual.value, `volume.value isn't defined`); | ||
assert.isNumber(actual.value, `volume.value isn't a number`); | ||
assert.isDefined(actual.formattedValue, `volume.formattedValue isn't defined`); | ||
assert.isNumber(actual.formattedValue, `volume.formattedValue isn't a number`); | ||
assert.isDefined(actual.formatted, `volume.formatted isn't defined`); | ||
assert.isString(actual.formatted, `volume.formatted isn't a string`); | ||
assert.isDefined(actual.roundedValue, `volume.roundedValue isn't defined`); | ||
assert.isNumber(actual.roundedValue, `volume.roundedValue isn't a number`); | ||
assert.isDefined(actual.rounded, `volume.rounded isn't defined`); | ||
assert.isString(actual.rounded, `volume.rounded isn't a string`); | ||
assert.isDefined(actual.minimized, `volume.minimized isn't defined`); | ||
assert.isString(actual.minimized, `volume.minimized isn't a string`); | ||
assert.isDefined(actual.denomination, `volume.denomination isn't defined`); | ||
assert.isString(actual.denomination, `volume.denomination isn't a String`); | ||
assert.isDefined(actual.full, `volume.full isn't defined`); | ||
assert.isString(actual.full, `volume.full isn't a string`); | ||
} | ||
// report: { | ||
@@ -171,7 +116,5 @@ // isUnethical: Boolean, | ||
module.exports = { | ||
tradingFeePercentAssertion: tradingFeePercentAssertion, | ||
marketAssertion: marketAssertion, | ||
volumeAssertion: volumeAssertion, | ||
reportAssertion: reportAssertion, | ||
marketLinkAssertion: marketLinkAssertion | ||
}; |
@@ -0,9 +1,11 @@ | ||
import { assert } from 'chai'; | ||
import selectors from '../src/selectors'; | ||
import createMarketFormAssertion from './assertions/createMarketForm'; | ||
describe(`selectors.createMarketForm tests:`, () => { | ||
it(`should contain a createMarketForm Object`, () => { | ||
it('should contain a createMarketForm object', () => { | ||
let actual = selectors.createMarketForm; | ||
createMarketFormAssertion(actual); | ||
assert.isDefined(actual, 'createMarketForm is not defined'); | ||
assert.isObject(actual, 'createMarketForm is not an object'); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
6840
1095774
33
160
3