Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new option ignore for disable dragging on some elements #157

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test about ignore option
  • Loading branch information
LoicMahieu committed Mar 29, 2016
commit 65890c7c7d955c37da1cad2c05d723d8eb05fae0
32 changes: 32 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('Slideout', function () {
'_initTouchEvents',
'_translateXTo',
'_setTransition',
'_elementIsIgnored',
'on',
'once',
'off',
Expand Down Expand Up @@ -191,4 +192,35 @@ describe('Slideout', function () {
setTimeout(function(){ slideout.close(); }, 750);
});
});

describe('._elementIsIgnored()', function() {
it('should return false when no ignore option.', function(){
slideout.destroy();
slideout = new Slideout({
'panel': doc.getElementById('panel'),
'menu': doc.getElementById('menu')
});
assert(slideout._elementIsIgnored(doc.getElementById('menu')) === false);
});

it('should return false when the provided element is not a children of a ignored path.', function(){
slideout.destroy();
slideout = new Slideout({
'panel': doc.getElementById('panel'),
'menu': doc.getElementById('menu'),
'ignore': '.menu-section-list'
});
assert(slideout._elementIsIgnored(doc.getElementById('menu')) === false);
});

it('should return true when the provided element is children of a ignored path.', function(){
slideout.destroy();
slideout = new Slideout({
'panel': doc.getElementById('panel'),
'menu': doc.getElementById('menu'),
'ignore': '.menu-section-list'
});
assert(slideout._elementIsIgnored(doc.querySelector('.menu-section-list a')) === true);
});
});
});