Skip to content

Commit

Permalink
Merge pull request #12 from progrape/master
Browse files Browse the repository at this point in the history
#10 修复页面内的元素无法触发`click`事件的bug
  • Loading branch information
progrape committed Dec 7, 2015
2 parents 2d8b153 + f61cb77 commit f0c048e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
4 changes: 2 additions & 2 deletions dist/swiper.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* swiper - swiper.js
* @version v1.4.0
* iswiper - swiper.js
* @version v1.4.1
* @link https://github.com/weui/swiper.git
* @license MIT
*/
Expand Down
7 changes: 3 additions & 4 deletions dist/swiper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* swiper - swiper.js
* @version v1.4.0
* iswiper - swiper.js
* @version v1.4.1
* @link https://github.com/weui/swiper.git
* @license MIT
*/
Expand All @@ -19,7 +19,7 @@
* @constructor
*/
function Swiper(options) {
this.version = '1.4.0';
this.version = '1.4.1';
this._default = {container: '.swiper', item: '.item', direction: 'vertical', activeClass: 'active', threshold: 50, duration: 300};
this._options = extend(this._default, options);
this._start = {};
Expand Down Expand Up @@ -124,7 +124,6 @@

me._show(me._current);

e.preventDefault();
}, false);

this.$container.addEventListener('transitionEnd', function (e) {
Expand Down
4 changes: 2 additions & 2 deletions dist/swiper.min.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* swiper - swiper.js
* @version v1.4.0
* iswiper - swiper.js
* @version v1.4.1
* @link https://github.com/weui/swiper.git
* @license MIT
*/
Expand Down
6 changes: 3 additions & 3 deletions dist/swiper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swiper",
"version": "1.4.0",
"name": "iswiper",
"version": "1.4.1",
"description": "swiper.js",
"author": "wechat ui team",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@

me._show(me._current);

e.preventDefault();
}, false);

this.$container.addEventListener('transitionEnd', function (e) {
Expand Down
31 changes: 14 additions & 17 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,6 @@ describe('swiper should have the following properties', function(){
}
});

describe('it should add classes to dom', function(){
var $slider = swiper.$items[swiper._current];
var $items = $slider.querySelectorAll('*[toggle-class]');
Array.prototype.forEach.call($items, function($item, index){
var clazz = $item.getAttribute('toggle-class').split(/\s+/);
for(var i = 0, len = clazz.length; i < len; i++){
(function(i){
it('.' + clazz, function(done){
setTimeout(function(){
assert($item.className.indexOf(clazz[i]) !== -1);
done();
}, 1000);
});
})(i);
}
});
});

describe('.next()', function (){
it('should translateY the container to the slide height & should add classes to dom', function (){
Expand All @@ -96,6 +79,20 @@ describe('.next()', function (){
});
});

describe('.go()', function (){
it('should translateY the container to the slide height & should add classes to dom', function (){
swiper.go(0);
for(var i = 1, len = swiper.$items.length; i < len; i++){
swiper.go(i);
var height = swiper.$items[i].style['height'].replace('px', '');
var expect = 'translate3d(0px, -'+ (height * i) +'px, 0px)';

assert(swiper._current === i);
assert(swiper.$container.style['-webkit-transform'] === expect);
}
});
});

describe('.on()', function (){
it('swiped listener should not be empty', function (){

Expand Down

0 comments on commit f0c048e

Please sign in to comment.