mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 02:49:13 +08:00
add visual tests, change mousemove instead of mouseenter in timepicker
This commit is contained in:
parent
001894484b
commit
920bab5032
3
dist/js/datepicker.js
vendored
3
dist/js/datepicker.js
vendored
@ -1029,7 +1029,6 @@
|
||||
},
|
||||
|
||||
_onShowEvent: function (e) {
|
||||
console.log(e.type);
|
||||
if (!this.visible) {
|
||||
this.show();
|
||||
}
|
||||
@ -1884,7 +1883,7 @@
|
||||
this.d.$el.on('selectDate', this._onSelectDate.bind(this));
|
||||
this.$ranges.on(input, this._onChangeRange.bind(this));
|
||||
this.$ranges.on('mouseup', this._onMouseUpRange.bind(this));
|
||||
this.$ranges.on('mouseenter focus ', this._onMouseEnterRange.bind(this));
|
||||
this.$ranges.on('mousemove focus ', this._onMouseEnterRange.bind(this));
|
||||
this.$ranges.on('mouseout blur', this._onMouseOutRange.bind(this));
|
||||
},
|
||||
|
||||
|
||||
4
dist/js/datepicker.min.js
vendored
4
dist/js/datepicker.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -438,4 +438,72 @@ a {
|
||||
background: #fff;
|
||||
opacity: .5;
|
||||
}
|
||||
}
|
||||
|
||||
// Visual tests
|
||||
// -------------------------------------------------
|
||||
|
||||
.visual-tests {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 120px;
|
||||
|
||||
h1 {
|
||||
color: #555;
|
||||
font-size: 20px;
|
||||
margin: 0;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.row {
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 16px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
article:last-child {
|
||||
.row {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vt-tile {
|
||||
padding: 16px;
|
||||
width: 284px;
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: monospace;
|
||||
font-size: 14px;
|
||||
margin: 0 0 8px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.v-log {
|
||||
position: fixed;
|
||||
padding: 8px;
|
||||
font-size: 12px;
|
||||
font-family: monospace;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
height: 100px;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
overflow: auto;
|
||||
z-index: 10;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: greenyellow;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #ddd;
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@
|
||||
"gulp-watch": "^4.3.5",
|
||||
"gulp-wrap": "^0.11.0",
|
||||
"jade": "^1.11.0",
|
||||
"mocha": "^2.3.4"
|
||||
"mocha": "^2.3.4",
|
||||
"node-static": "^0.7.7"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1029,7 +1029,6 @@
|
||||
},
|
||||
|
||||
_onShowEvent: function (e) {
|
||||
console.log(e.type);
|
||||
if (!this.visible) {
|
||||
this.show();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
this.d.$el.on('selectDate', this._onSelectDate.bind(this));
|
||||
this.$ranges.on(input, this._onChangeRange.bind(this));
|
||||
this.$ranges.on('mouseup', this._onMouseUpRange.bind(this));
|
||||
this.$ranges.on('mouseenter focus ', this._onMouseEnterRange.bind(this));
|
||||
this.$ranges.on('mousemove focus ', this._onMouseEnterRange.bind(this));
|
||||
this.$ranges.on('mouseout blur', this._onMouseOutRange.bind(this));
|
||||
},
|
||||
|
||||
|
||||
10
static-server.js
Normal file
10
static-server.js
Normal file
@ -0,0 +1,10 @@
|
||||
var static = require('node-static'),
|
||||
http = require('http');
|
||||
|
||||
var file = new static.Server('.');
|
||||
|
||||
http.createServer(function (request, response) {
|
||||
request.addListener('end', function () {
|
||||
file.serve(request, response);
|
||||
}).resume();
|
||||
}).listen(3000);
|
||||
87
visual-tests.html
Normal file
87
visual-tests.html
Normal file
@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Air datepicker visual tests</title>
|
||||
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="dist/js/datepicker.js"></script>
|
||||
<link rel="stylesheet" href="dist/css/datepicker.css"/>
|
||||
<link rel="stylesheet" href="docs/css/style.css"/>
|
||||
<script type="text/javascript">
|
||||
var log;
|
||||
function logger (el) {
|
||||
var $el = $(el);
|
||||
|
||||
return function(text) {
|
||||
var count = $('p', $el).length;
|
||||
$el.append('<p><span>' + count++ + '.</span> ' + text + '</p>').scrollTop(100000)
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
log = logger('#v-log');
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="v-log" id="v-log"></div>
|
||||
<div class="visual-tests">
|
||||
<article>
|
||||
<h1>Basic</h1>
|
||||
<div class="row">
|
||||
<div class="vt-tile">
|
||||
<h2>Default</h2>
|
||||
<div class="datepicker-here"></div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<h1>Range</h1>
|
||||
<div class="row">
|
||||
<div class="vt-tile">
|
||||
<h2>{range: true}</h2>
|
||||
<div class="datepicker-here" data-range="true"></div>
|
||||
</div>
|
||||
<div class="vt-tile">
|
||||
<h2>{range: true, onSelect: ...}</h2>
|
||||
<div class="datepicker-here" id="dp-3" data-range="true"></div>
|
||||
<script type="text/javascript">
|
||||
$('#dp-3').datepicker({
|
||||
onSelect: function (fd) {
|
||||
log(fd)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
<div class="vt-tile">
|
||||
<h2>{range: true, onSelect: ...}</h2>
|
||||
<input class="datepicker-here" id="dp-4" data-range="true"/>
|
||||
<script type="text/javascript">
|
||||
$('#dp-4').datepicker({
|
||||
onSelect: function (fd) {
|
||||
log(fd)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<h1>Timepicker</h1>
|
||||
<div class="row">
|
||||
<div class="vt-tile">
|
||||
<h2>{timepicker: true}</h2>
|
||||
<div class="datepicker-here" data-timepicker="true"></div>
|
||||
</div>
|
||||
<div class="vt-tile">
|
||||
<h2>{timepicker: true}</h2>
|
||||
<input class="datepicker-here" data-timepicker="true" />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user