Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"plugins": ["react"],
"extends": ["airbnb", "prettier"],
"rules": {
"no-console": ["error", { "allow": ["warn", "error"] }],
"import/named": 2,
"react/jsx-filename-extension": 0,
"react/require-default-props": 0
Expand Down
27 changes: 18 additions & 9 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ machine:
version: 7.9.0
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
MOCHA_FILE: "$CIRCLE_TEST_REPORTS/test-results.xml"

general:
artifacts:
Expand All @@ -11,20 +12,28 @@ general:
dependencies:
override:
- yarn
- yarn global add codeclimate-test-reporter
cache_directories:
- ~/.cache/yarn

test:
pre:
- yarn run lint
- yarn run dtslint
- mkdir -p $CIRCLE_TEST_REPORTS/reports
override:
- >
MOCHA_FILE=$CIRCLE_TEST_REPORTS/test-results.xml
yarn run cover
- yarn run lint -- --format junit --output-file $CIRCLE_TEST_REPORTS/reports/eslint.xml
- yarn run dtslint
- yarn run cover -- --reporter mocha-circleci-reporter
post:
- cp -R ./coverage $CIRCLE_ARTIFACTS
- >
CODECLIMATE_REPO_TOKEN=$CODECLIMATE_REPO_TOKEN
codeclimate-test-reporter < ./coverage/lcov.info
- ./node_modules/codeclimate-test-reporter/bin/codeclimate.js < ./coverage/lcov.info
- ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info

deployment:
hub-master:
branch: master
commands:
- yarn run build
release:
tag: /v.*/
commands:
- yarn run build
- yarn run docs:publish
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"dtslint": "dtslint types",
"prettify": "prettier --write --single-quote --trailing-comma=\"es5\" \"{src,test,examples/src}/**/*.js\"",
"precommit": "lint-staged",
"test": "mocha --compilers js:babel-core/register --require ./test/setup.js --recursive --reporter spec",
"test": "mocha --compilers js:babel-core/register --require ./test/setup.js --recursive",
"test:watch": "npm test -- --watch",
"test:files": "mocha --compilers js:babel-core/register --require ./test/setup.js --reporter spec --bail --watch",
"cover": "babel-node ./node_modules/istanbul/lib/cli cover -- _mocha --recursive --reporter spec",
"cover": "babel-node ./node_modules/istanbul/lib/cli cover -- _mocha --recursive",
"check": "npm run lint && npm run dtslint && npm run test",
"prerelease": "npm run check && npm run build",
"build": "npm run build:node && npm run build:production && npm run build:development",
Expand Down Expand Up @@ -78,6 +78,7 @@
"chai": "3.5.0",
"chai-enzyme": "0.6.1",
"cheerio": "0.22.0",
"codeclimate-test-reporter": "^0.4.1",
"coveralls": "2.13.0",
"dtslint": "^0.1.2",
"enzyme": "2.8.2",
Expand All @@ -93,6 +94,8 @@
"jsdom": "9.0.0",
"lint-staged": "3.4.0",
"mocha": "3.2.0",
"mocha-circleci-reporter": "^0.0.2",
"mocha-junit-reporter": "^1.13.0",
"moment": "2.18.1",
"postcss-cli": "3.1.1",
"prettier": "1.2.2",
Expand Down
4 changes: 1 addition & 3 deletions src/Helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
clone
} from './DateUtils';
import { clone } from './DateUtils';
import { getFirstDayOfWeek } from './LocaleUtils';

export function cancelEvent(e) {
Expand Down
25 changes: 11 additions & 14 deletions test/ModifierUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ describe('dayMatchesModifier', () => {
modifiers.forEach(day => {
expect(ModifierUtils.dayMatchesModifier(day, modifiers)).to.be.true;
});
expect(ModifierUtils.dayMatchesModifier(new Date(2015, 8, 22), modifiers)).to.be.false;
expect(ModifierUtils.dayMatchesModifier(new Date(2015, 8, 22), modifiers))
.to.be.false;
});
it('accepts an array of days ignoring falsy values', () => {
const values = [null, 'test', new Date(2015, 8, 21)];
Expand All @@ -47,7 +48,6 @@ describe('dayMatchesModifier', () => {
expect(match).to.be.true;
});
it('returns a boolean for a range of days', () => {
console.log('what the hell');
const range = {
from: new Date(2015, 8, 18),
to: new Date(2015, 8, 20),
Expand All @@ -58,10 +58,7 @@ describe('dayMatchesModifier', () => {
);
expect(match).to.be.true;

const fail = ModifierUtils.dayMatchesModifier(
new Date(2015, 8, 17),
range
);
const fail = ModifierUtils.dayMatchesModifier(new Date(2015, 8, 17), range);
expect(fail).to.be.false;
});
it('returns a boolean for multiple ranges of days', () => {
Expand Down Expand Up @@ -89,7 +86,7 @@ describe('dayMatchesModifier', () => {
});
it('returns a boolean for an "after" modifier', () => {
const afterModifier = {
after: new Date(2015, 8, 18)
after: new Date(2015, 8, 18),
};
const match = ModifierUtils.dayMatchesModifier(
new Date(2015, 8, 19),
Expand All @@ -104,7 +101,7 @@ describe('dayMatchesModifier', () => {
expect(fail).to.be.false;
});
it('returns a boolean for an "after" modifier in array', () => {
const afterModifier = [{after: new Date(2015, 8, 18)}];
const afterModifier = [{ after: new Date(2015, 8, 18) }];

const match = ModifierUtils.dayMatchesModifier(
new Date(2015, 8, 19),
Expand Down Expand Up @@ -135,7 +132,7 @@ describe('dayMatchesModifier', () => {
expect(fail).to.be.false;
});
it('returns a boolean "before" modifier in an array of days', () => {
const afterModifier = [{before: new Date(2015, 8, 15)}];
const afterModifier = [{ before: new Date(2015, 8, 15) }];

const match = ModifierUtils.dayMatchesModifier(
new Date(2015, 8, 10),
Expand All @@ -151,7 +148,7 @@ describe('dayMatchesModifier', () => {
});
it('works with mixing functions and other objects', () => {
const mixedModifiers = [
{before: new Date(2015, 8, 15)},
{ before: new Date(2015, 8, 15) },
day => day.getTime() === new Date(2015, 8, 17).getTime(),
];
const match1 = ModifierUtils.dayMatchesModifier(
Expand Down Expand Up @@ -326,7 +323,7 @@ describe('getModifiersForDay', () => {
});
it('returns an "after" modifier in an array of days', () => {
const afterModifier = {
foo: [{after: new Date(2015, 8, 18)}],
foo: [{ after: new Date(2015, 8, 18) }],
};
const modifiers = ModifierUtils.getModifiersForDay(
new Date(2015, 8, 19),
Expand All @@ -350,7 +347,7 @@ describe('getModifiersForDay', () => {
});
it('returns a "before" modifier in an array of days', () => {
const afterModifier = {
foo: [{before: new Date(2015, 8, 15)}],
foo: [{ before: new Date(2015, 8, 15) }],
};
const modifiers = ModifierUtils.getModifiersForDay(
new Date(2015, 8, 10),
Expand All @@ -362,7 +359,7 @@ describe('getModifiersForDay', () => {
it('works with mixing functions and other objects', () => {
const mixedModifiers = {
foo: [
{before: new Date(2015, 8, 15)},
{ before: new Date(2015, 8, 15) },
day => day.getTime() === new Date(2015, 8, 17).getTime(),
],
};
Expand All @@ -384,4 +381,4 @@ describe('getModifiersForDay', () => {
const modifiers = ModifierUtils.getModifiersForDay(new Date(2015, 8, 19));
expect(modifiers).to.have.length(0);
});
});
});
51 changes: 48 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async-some@~1.0.2:
dependencies:
dezalgo "^1.0.2"

async@1.x, async@^1.4.0, async@^1.4.2:
async@1.x, async@^1.4.0, async@^1.4.2, async@~1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"

Expand Down Expand Up @@ -1199,6 +1199,10 @@ char-spinner@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/char-spinner/-/char-spinner-1.0.1.tgz#e6ea67bd247e107112983b7ab0479ed362800081"

charenc@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"

cheerio@0.22.0, cheerio@^0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-0.22.0.tgz#a9baa860a3f9b595a6b81b1a86873121ed3a269e"
Expand Down Expand Up @@ -1323,6 +1327,15 @@ code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"

codeclimate-test-reporter@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/codeclimate-test-reporter/-/codeclimate-test-reporter-0.4.1.tgz#9f20f6d82d36aab99d20abe4f6c7372f4c6d1915"
dependencies:
async "~1.5.2"
commander "2.9.0"
lcov-parse "0.0.10"
request "~2.74.0"

collapse-white-space@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-1.0.2.tgz#9c463fb9c6d190d2dcae21a356a01bcae9eeef6d"
Expand Down Expand Up @@ -1478,6 +1491,10 @@ cross-spawn@^5.0.1:
shebang-command "^1.2.0"
which "^1.2.9"

crypt@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"

cryptiles@2.x.x:
version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
Expand Down Expand Up @@ -2740,7 +2757,7 @@ is-binary-path@^1.0.0:
dependencies:
binary-extensions "^1.0.0"

is-buffer@^1.0.2:
is-buffer@^1.0.2, is-buffer@~1.1.1:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"

Expand Down Expand Up @@ -3511,6 +3528,14 @@ lru-cache@^4.0.1, lru-cache@~4.0.1:
pseudomap "^1.0.1"
yallist "^2.0.0"

md5@^2.1.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9"
dependencies:
charenc "~0.0.1"
crypt "~0.0.1"
is-buffer "~1.1.1"

memory-fs@^0.4.0, memory-fs@~0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
Expand Down Expand Up @@ -3600,7 +3625,23 @@ mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi
dependencies:
minimist "0.0.8"

mocha@3.2.0:
mocha-circleci-reporter@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/mocha-circleci-reporter/-/mocha-circleci-reporter-0.0.2.tgz#6cbb3f1a1911ce2365e79461a156370b63790c7e"
dependencies:
mocha "^3.0.0"
mocha-junit-reporter "^1.12.0"

mocha-junit-reporter@^1.12.0, mocha-junit-reporter@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.13.0.tgz#030db8c530b244667253b03861d4cd336f7e56c8"
dependencies:
debug "^2.2.0"
md5 "^2.1.0"
mkdirp "~0.5.1"
xml "^1.0.0"

mocha@3.2.0, mocha@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3"
dependencies:
Expand Down Expand Up @@ -5626,6 +5667,10 @@ write@^0.2.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635"

xml@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"

xtend@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
Expand Down