rc-calendar
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -6,3 +6,2 @@ /** @jsx React.DOM */ | ||
var Calendar = require('../'); | ||
@@ -21,4 +20,29 @@ var CalendarInput = require('./CalendarInput'); | ||
} | ||
var Skin = React.createClass({ | ||
getInitialState: function () { | ||
return { | ||
skin: '/assets/bootstrap.css' | ||
} | ||
}, | ||
onClick: function () { | ||
this.setState({ | ||
skin: this.state.skin.indexOf('bootstrap')!==-1 ? '/assets/dpl.css' : '/assets/bootstrap.css' | ||
}); | ||
}, | ||
render: function () { | ||
return <div> | ||
<link href={this.state.skin} rel="stylesheet"/> | ||
<div> | ||
<button onClick={this.onClick}>change skin</button> | ||
</div> | ||
</div>; | ||
} | ||
}); | ||
React.render( | ||
<div> | ||
<Skin/> | ||
<h2>calendar (en-us)</h2> | ||
@@ -25,0 +49,0 @@ <Calendar showWeekNumber="1" onSelect={onSelect}/> |
@@ -21,2 +21,9 @@ var gulp = require('gulp'); | ||
gulp.task('less', function () { | ||
var less = require('gulp-less'); | ||
return gulp.src('assets/*.less') | ||
.pipe(less()) | ||
.pipe(gulp.dest('assets/')); | ||
}); | ||
gulp.task('tag', function (done) { | ||
@@ -39,11 +46,18 @@ var cp = require('child_process'); | ||
gulp.task('less', function () { | ||
var less = require('gulp-less'); | ||
gulp.src('assets/*.less') | ||
.pipe(less()) | ||
.pipe(gulp.dest('assets/')); | ||
gulp.task('saucelabs', function (done) { | ||
require('saucelabs-runner')({ | ||
browsers: [ | ||
{browserName: 'chrome'}, | ||
{browserName: 'firefox'}, | ||
{browserName: 'internet explorer', version: 8}, | ||
{browserName: 'internet explorer', version: 9}, | ||
{browserName: 'internet explorer', version: 10}, | ||
{browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'} | ||
] | ||
}).fin(function () { | ||
done(); | ||
setTimeout(function () { | ||
process.exit(0); | ||
}, 1000); | ||
}); | ||
}); | ||
gulp.task('watch-less',function(){ | ||
gulp.watch('assets/**/*.less',['less']); | ||
}); |
{ | ||
"name": "rc-calendar", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "calendar ui component for react", | ||
@@ -23,3 +23,2 @@ "keywords": [ | ||
"licenses": "MIT", | ||
"spm": {}, | ||
"config": { | ||
@@ -29,12 +28,13 @@ "port": 8001 | ||
"scripts": { | ||
"start": "node --harmony server", | ||
"publish": "gulp tag", | ||
"prepublish": "gulp less", | ||
"start": "node --harmony node_modules/.bin/rc-server", | ||
"publish": "spm publish && gulp tag", | ||
"lint": "gulp lint", | ||
"test": "", | ||
"saucelabs": "DEBUG=saucelabs-runner gulp saucelabs", | ||
"browser-test": "mocha-phantomjs http://localhost:$npm_package_config_port/tests/runner.html", | ||
"browser-test-cover": "mocha-phantomjs -R node_modules/node-jscover/lib/reporters/mocha/console http://localhost:$npm_package_config_port/tests/runner.html?coverage" | ||
"browser-test-cover": "mocha-phantomjs -R node_modules/rc-server/node_modules/node-jscover/lib/reporters/mocha/console http://localhost:$npm_package_config_port/tests/runner.html?coverage" | ||
}, | ||
"devDependencies": { | ||
"console-polyfill": "^0.1.2", | ||
"es5-shim": "~4.0.5", | ||
"async": "~0.9.0", | ||
"expect.js": "~0.3.1", | ||
@@ -52,19 +52,11 @@ "gh-changelog": "^1.0.5", | ||
"jshint-stylish": "^0.4.0", | ||
"koa": "~0.13.0", | ||
"koa-body": "^0.4.0", | ||
"koa-jsx": "^1.1.3", | ||
"koa-modularize": "^3.0.0", | ||
"koa-mount": "~1.3.0", | ||
"koa-node-jscover": "^1.0.0", | ||
"koa-serve-index": "~1.0.1", | ||
"koa-static": "~1.4.7", | ||
"mocha": "~2.0.1", | ||
"modulex": "~1.7.3", | ||
"node-jscover": "^0.6.8", | ||
"node-jscover-coveralls": "^1.0.13", | ||
"modulex": "^1.7.4", | ||
"precommit-hook": "^1.0.7", | ||
"rc-server": "^1.0.0", | ||
"rc-test-utils": "~1.0.0", | ||
"react": "~0.12.1", | ||
"react-tools": "~0.12.1", | ||
"saucelabs-runner": "~2.0.0", | ||
"simulate-dom-event": "^1.0.1", | ||
"sinon": "^1.12.1" | ||
"sinon": "^1.12.1", | ||
"wd": "^0.3.11" | ||
}, | ||
@@ -89,7 +81,14 @@ "precommit": [ | ||
"dependencies": { | ||
"browserify-jsx": "^0.1.0", | ||
"browserify-shim": "^3.8.0", | ||
"gregorian-calendar": "^2.0.0", | ||
"gregorian-calendar-format": "^2.0.0", | ||
"browserify-shim": "^3.8.0", | ||
"browserify-jsx": "^0.1.0" | ||
"gregorian-calendar-format": "^2.0.0" | ||
}, | ||
"spm": { | ||
"dependencies": { | ||
"react": "~0.12.1", | ||
"gregorian-calendar": "^2.0.0", | ||
"gregorian-calendar-format": "^2.0.0" | ||
} | ||
} | ||
} |
@@ -11,3 +11,6 @@ # rc-calendar | ||
[![npm download][download-image]][download-url] | ||
[![Sauce Test Status](https://saucelabs.com/buildstatus/rc-calendar)](https://saucelabs.com/u/rc-calendar) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/rc-calendar.svg)](https://saucelabs.com/u/rc-calendar) | ||
[npm-image]: http://img.shields.io/npm/v/rc-calendar.svg?style=flat-square | ||
@@ -32,2 +35,3 @@ [npm-url]: http://npmjs.org/package/rc-calendar | ||
* support ie8,ie8+,chrome,firefox,safari | ||
* support date, month, year, decade select panel | ||
@@ -114,3 +118,3 @@ * support week number | ||
http://localhost:8001/examples/index.html | ||
http://localhost:8001/examples/index.md | ||
@@ -124,3 +128,3 @@ | ||
http://localhost:8001/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8001/tests/runner.html?coverage | ||
http://localhost:8001/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8001/tests/runner.html?coverage | ||
@@ -127,0 +131,0 @@ ## License |
@@ -5,14 +5,85 @@ /** @jsx React.DOM */ | ||
var Calendar = require('../index'); | ||
var React = require('react'); | ||
var sinon = require('sinon'); | ||
var React = require('react/addons'); | ||
// var sinon = require('sinon'); | ||
var $ = require('jquery'); | ||
var simulateDomEvent = require('simulate-dom-event'); | ||
var TestUtils = React.addons.TestUtils; | ||
var Simulate = TestUtils.Simulate; | ||
var async = require('async'); | ||
describe('calendar', function () { | ||
function onSelect() { | ||
} | ||
$('<link href="/assets/dpl.css" rel="stylesheet"/>').appendTo(document.getElementsByTagName('head')[0]); | ||
React.render(<Calendar showToday={1} onSelect={onSelect}/>, document.getElementById('content')); | ||
var calendar; | ||
var container = $('#content')[0]; | ||
it('works',function(){}); | ||
beforeEach(function (done) { | ||
React.render(<Calendar showToday={1} />, container, function () { | ||
calendar = this; | ||
done(); | ||
}); | ||
}); | ||
afterEach(function () { | ||
React.unmountComponentAtNode(container); | ||
}); | ||
it('render works', function () { | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-cell').length).to.above(0); | ||
}); | ||
it('onSelect works', function (done) { | ||
var day; | ||
calendar.setProps({ | ||
onSelect: function (d) { | ||
expect(d.getDayOfMonth()).to.be(parseInt(day.props.children), 10); | ||
done(); | ||
} | ||
}, function () { | ||
calendar = this; | ||
day = TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-date')[5]; | ||
Simulate.click(day); | ||
}); | ||
}); | ||
it('month panel shows', function (done) { | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-month-panel').length).to.be(0); | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-month-select')); | ||
setTimeout(function () { | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-month-panel').length).to.be(1); | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-month-panel-month').length).to.be(12); | ||
done(); | ||
}, 10); | ||
}); | ||
it('year panel works', function (done) { | ||
async.series([function (done) { | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-month-select')); | ||
setTimeout(done, 10); | ||
}, function (done) { | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-month-panel-year-select')); | ||
setTimeout(done, 10); | ||
}, function (done) { | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-year-panel').length).to.be(1); | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-year-panel-year').length).to.be(12); | ||
done(); | ||
}], done); | ||
}); | ||
it('decade panel works', function (done) { | ||
async.series([function (done) { | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-month-select')); | ||
setTimeout(done, 10); | ||
}, function (done) { | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-month-panel-year-select')); | ||
setTimeout(done, 10); | ||
}, function (done) { | ||
Simulate.click(TestUtils.findRenderedDOMComponentWithClass(calendar, 'rc-calendar-year-panel-decade-select')); | ||
setTimeout(done, 10); | ||
}, function (done) { | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-decade-panel').length).to.be(1); | ||
expect(TestUtils.scryRenderedDOMComponentsWithClass(calendar, 'rc-calendar-decade-panel-decade').length).to.be(12); | ||
done(); | ||
}], done); | ||
}); | ||
}); |
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
88309
22
2425
129
0
34