mirror of
https://github.com/wassname/slider.git
synced 2026-09-11 12:42:49 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c36e3949f |
+25
-8
@@ -1,19 +1,36 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- yiminghe@gmail.com
|
- yiminghe@gmail.com
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- 0.12
|
- 0.12
|
||||||
before_script:
|
|
||||||
- npm start &
|
before_install:
|
||||||
- npm install mocha-phantomjs -g
|
- |
|
||||||
- phantomjs --version
|
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:
|
script:
|
||||||
- npm test
|
- |
|
||||||
- npm run browser-test
|
if [ "$TEST_TYPE" = test ]; then
|
||||||
- npm run browser-test-cover
|
npm test
|
||||||
- npm run saucelabs
|
else
|
||||||
|
npm run $TEST_TYPE
|
||||||
|
fi
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
matrix:
|
||||||
|
- TEST_TYPE=lint
|
||||||
|
- TEST_TYPE=browser-test
|
||||||
|
- TEST_TYPE=browser-test-cover
|
||||||
|
- TEST_TYPE=saucelabs
|
||||||
global:
|
global:
|
||||||
- secure: S1VwbaPzLnSH/IUT/wlJulxAX5VHRIDmSt53h/ycHcZsszUpWcLCJRQAe0fTVB2dAx5MdBbSZ+o+tr3tRwVB5TRAYm0oTCsYAkOZaWOB28RuUQtdGt3wf9xxTG1UiPiaLLUW3waX9zAaf3yqKBcJGf1op0RD8dksxbCFw/7xVbU=
|
- secure: S1VwbaPzLnSH/IUT/wlJulxAX5VHRIDmSt53h/ycHcZsszUpWcLCJRQAe0fTVB2dAx5MdBbSZ+o+tr3tRwVB5TRAYm0oTCsYAkOZaWOB28RuUQtdGt3wf9xxTG1UiPiaLLUW3waX9zAaf3yqKBcJGf1op0RD8dksxbCFw/7xVbU=
|
||||||
- secure: EBEDg8k///IlEsnx0AE8X3mbFl0QE5+xGKbG4AxXlGZda12uTIPUSMKJzdZQ2hVbZXduTzf1cQl9rcu9nGoSnkL/DWnIax9cvHi+1orx5+YPlxPHNWAwWByTnHosBn2MJhfy1s5paJfHC9cUzmmEL6x4fYthWxjsPUo+irEZH6E=
|
- secure: EBEDg8k///IlEsnx0AE8X3mbFl0QE5+xGKbG4AxXlGZda12uTIPUSMKJzdZQ2hVbZXduTzf1cQl9rcu9nGoSnkL/DWnIax9cvHi+1orx5+YPlxPHNWAwWByTnHosBn2MJhfy1s5paJfHC9cUzmmEL6x4fYthWxjsPUo+irEZH6E=
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-mark-text {
|
&-mark-text {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: inline-block;
|
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) {
|
function pauseEvent(e) {
|
||||||
if (e.stopPropagation) {
|
if (e.stopPropagation) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
if (e.preventDefault) {
|
if (e.preventDefault) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ var Slider = React.createClass({
|
|||||||
|
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
var props = this.props;
|
var props = this.props;
|
||||||
if (props.marks.length === 0) {
|
if (props.marks.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var value = this.state.value;
|
var value = this.state.value;
|
||||||
@@ -213,7 +213,7 @@ var Slider = React.createClass({
|
|||||||
|
|
||||||
var sliderMin = rect.left;
|
var sliderMin = rect.left;
|
||||||
var sliderMax = rect.right;
|
var sliderMax = rect.right;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
upperBound: slider.clientWidth,
|
upperBound: slider.clientWidth,
|
||||||
sliderLength: Math.abs(sliderMax - sliderMin),
|
sliderLength: Math.abs(sliderMax - sliderMin),
|
||||||
@@ -238,7 +238,7 @@ var Slider = React.createClass({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var position = this._getMousePosition(e);
|
var position = this._getMousePosition(e);
|
||||||
this._calValueByPos(position,
|
this._calValueByPos(position,
|
||||||
() => {
|
() => {
|
||||||
this._triggerEvents('onChange');
|
this._triggerEvents('onChange');
|
||||||
this._start(position);
|
this._start(position);
|
||||||
+3
-4
@@ -34,10 +34,9 @@
|
|||||||
"start": "node-dev --harmony node_modules/.bin/rc-server",
|
"start": "node-dev --harmony node_modules/.bin/rc-server",
|
||||||
"publish": "spm publish && rc-tools run tag",
|
"publish": "spm publish && rc-tools run tag",
|
||||||
"lint": "rc-tools run lint",
|
"lint": "rc-tools run lint",
|
||||||
"test": "",
|
"saucelabs": "node --harmony node_modules/.bin/rc-tools run saucelabs",
|
||||||
"saucelabs": "rc-tools run saucelabs",
|
"browser-test": "node --harmony node_modules/.bin/rc-tools run browser-test",
|
||||||
"browser-test": "rc-tools run browser-test",
|
"browser-test-cover": "node --harmony node_modules/.bin/rc-tools run browser-test-cover"
|
||||||
"browser-test-cover": "rc-tools run browser-test-cover"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"expect.js": "0.3.x",
|
"expect.js": "0.3.x",
|
||||||
|
|||||||
Reference in New Issue
Block a user