mirror of
https://github.com/wassname/slider.git
synced 2026-09-10 12:38:09 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c36e3949f |
+25
-8
@@ -1,19 +1,36 @@
|
||||
language: node_js
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- yiminghe@gmail.com
|
||||
|
||||
node_js:
|
||||
- 0.12
|
||||
before_script:
|
||||
- npm start &
|
||||
- npm install mocha-phantomjs -g
|
||||
- phantomjs --version
|
||||
|
||||
before_install:
|
||||
- |
|
||||
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
|
||||
then
|
||||
echo "Only docs were updated, stopping build process."
|
||||
exit
|
||||
fi
|
||||
npm install mocha-phantomjs -g
|
||||
phantomjs --version
|
||||
|
||||
script:
|
||||
- npm test
|
||||
- npm run browser-test
|
||||
- npm run browser-test-cover
|
||||
- npm run saucelabs
|
||||
- |
|
||||
if [ "$TEST_TYPE" = test ]; then
|
||||
npm test
|
||||
else
|
||||
npm run $TEST_TYPE
|
||||
fi
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- TEST_TYPE=lint
|
||||
- TEST_TYPE=browser-test
|
||||
- TEST_TYPE=browser-test-cover
|
||||
- TEST_TYPE=saucelabs
|
||||
global:
|
||||
- secure: S1VwbaPzLnSH/IUT/wlJulxAX5VHRIDmSt53h/ycHcZsszUpWcLCJRQAe0fTVB2dAx5MdBbSZ+o+tr3tRwVB5TRAYm0oTCsYAkOZaWOB28RuUQtdGt3wf9xxTG1UiPiaLLUW3waX9zAaf3yqKBcJGf1op0RD8dksxbCFw/7xVbU=
|
||||
- secure: EBEDg8k///IlEsnx0AE8X3mbFl0QE5+xGKbG4AxXlGZda12uTIPUSMKJzdZQ2hVbZXduTzf1cQl9rcu9nGoSnkL/DWnIax9cvHi+1orx5+YPlxPHNWAwWByTnHosBn2MJhfy1s5paJfHC9cUzmmEL6x4fYthWxjsPUo+irEZH6E=
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@
|
||||
font-size: 12px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
|
||||
&-mark-text {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright 2013-2014 Facebook, Inc.
|
||||
*
|
||||
* This file contains a modified version of:
|
||||
* https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/EventListener.js
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* TODO: remove in favour of solution provided by:
|
||||
* https://github.com/facebook/react/issues/285
|
||||
*/
|
||||
|
||||
/**
|
||||
* Does not take into account specific nature of platform.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var EventListener = {
|
||||
/**
|
||||
* Listen to DOM events during the bubble phase.
|
||||
*
|
||||
* @param {DOMEventTarget} target DOM element to register listener on.
|
||||
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
||||
* @param {function} callback Callback function.
|
||||
* @return {object} Object with a `remove` method.
|
||||
*/
|
||||
listen: function listen(target, eventType, callback) {
|
||||
if (target.addEventListener) {
|
||||
target.addEventListener(eventType, callback, false);
|
||||
return {
|
||||
remove: function remove() {
|
||||
target.removeEventListener(eventType, callback, false);
|
||||
}
|
||||
};
|
||||
} else if (target.attachEvent) {
|
||||
target.attachEvent('on' + eventType, callback);
|
||||
return {
|
||||
remove: function remove() {
|
||||
target.detachEvent('on' + eventType, callback);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = EventListener;
|
||||
@@ -5,7 +5,7 @@ var DomUtils = require('rc-util').Dom;
|
||||
function pauseEvent(e) {
|
||||
if (e.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
@@ -88,7 +88,7 @@ var Slider = React.createClass({
|
||||
|
||||
getIndex: function() {
|
||||
var props = this.props;
|
||||
if (props.marks.length === 0) {
|
||||
if (props.marks.length === 0) {
|
||||
return;
|
||||
}
|
||||
var value = this.state.value;
|
||||
@@ -213,7 +213,7 @@ var Slider = React.createClass({
|
||||
|
||||
var sliderMin = rect.left;
|
||||
var sliderMax = rect.right;
|
||||
|
||||
|
||||
this.setState({
|
||||
upperBound: slider.clientWidth,
|
||||
sliderLength: Math.abs(sliderMax - sliderMin),
|
||||
@@ -238,7 +238,7 @@ var Slider = React.createClass({
|
||||
return;
|
||||
}
|
||||
var position = this._getMousePosition(e);
|
||||
this._calValueByPos(position,
|
||||
this._calValueByPos(position,
|
||||
() => {
|
||||
this._triggerEvents('onChange');
|
||||
this._start(position);
|
||||
+3
-4
@@ -34,10 +34,9 @@
|
||||
"start": "node-dev --harmony node_modules/.bin/rc-server",
|
||||
"publish": "spm publish && rc-tools run tag",
|
||||
"lint": "rc-tools run lint",
|
||||
"test": "",
|
||||
"saucelabs": "rc-tools run saucelabs",
|
||||
"browser-test": "rc-tools run browser-test",
|
||||
"browser-test-cover": "rc-tools run browser-test-cover"
|
||||
"saucelabs": "node --harmony node_modules/.bin/rc-tools run saucelabs",
|
||||
"browser-test": "node --harmony node_modules/.bin/rc-tools run browser-test",
|
||||
"browser-test-cover": "node --harmony node_modules/.bin/rc-tools run browser-test-cover"
|
||||
},
|
||||
"devDependencies": {
|
||||
"expect.js": "0.3.x",
|
||||
|
||||
Reference in New Issue
Block a user