Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
timkeane committed May 5, 2017
2 parents 2475e89 + 4d651c9 commit 5376041
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {

ext {
appName = 'nyc-lib'
ver = 'v0.2.5-SNAPSHOT'
ver = 'v0.2.5'
pkgDir = "${buildDir}/${appName}/${ver}"
remoteDir = "${appName}/${ver}"
srcDir = "${projectDir}/src/main"
Expand Down
7 changes: 3 additions & 4 deletions src/main/js/nyc/ol/control/layerfade.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ nyc.ol.control.LayerFade.prototype = {
var name = layer.get('name'),
li = $('<li class="fade-lyr"></li>'),
span = $('<span></sapn>');
span.data('fade-idx', i + 1);
span.click($.proxy(me.swap, me));
li.data('fade-idx', i + 1);
li.click($.proxy(me.swap, me));
li.html(name)
.data('fade-layer', name)
.append(span);
Expand All @@ -113,9 +113,8 @@ nyc.ol.control.LayerFade.prototype = {
* @param {JQuery.Event} event
*/
swap: function(event){
var span = $(event.currentTarget), idx = span.data('fade-idx');
var li = $(event.currentTarget), idx = li.data('fade-idx');
if (!isNaN(idx)){
var li = span.parent();
if (li.parent().is('ol')){
var before = [];
$('ul.fade-choices span').each(function(){
Expand Down
20 changes: 10 additions & 10 deletions src/test/js/nyc/ol/control/layerfade.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,31 +194,31 @@ QUnit.test('swap', function(assert){
assert.equal(fade.getElem('.mnu-fade ol li').length, 1);
assert.equal(fade.getElem('.mnu-fade ol li').not('.fade-msg').length, 0);

var span0 = $(fade.getElem('.mnu-fade ul li').get(0)).find('span');
var span1 = $(fade.getElem('.mnu-fade ul li').get(1)).find('span');
var span2 = $(fade.getElem('.mnu-fade ul li').get(2)).find('span');
var span3 = $(fade.getElem('.mnu-fade ul li').get(3)).find('span');
var li0 = $(fade.getElem('.mnu-fade ul li').get(0));
var li1 = $(fade.getElem('.mnu-fade ul li').get(1));
var li2 = $(fade.getElem('.mnu-fade ul li').get(2));
var li3 = $(fade.getElem('.mnu-fade ul li').get(3));

span1.trigger('click');
li1.trigger('click');

assert.equal($('.fade-msg').length, 0);
assert.equal(fade.getElem('.mnu-fade ul li').length, 3);
assert.equal(fade.getElem('.mnu-fade ol li').length, 1);
assert.equal(fade.getElem('.mnu-fade ol li').data('fade-layer'), 'layer2');

span0.trigger('click');
li0.trigger('click');

assert.equal(fade.getElem('.mnu-fade ul li').length, 2);
assert.equal(fade.getElem('.mnu-fade ol li').length, 2);
assert.equal($(fade.getElem('.mnu-fade ol li').get(0)).data('fade-layer'), 'layer2');
assert.equal($(fade.getElem('.mnu-fade ol li').get(1)).data('fade-layer'), 'layer1');

span1.trigger('click');
li1.trigger('click');

assert.equal(fade.getElem('.mnu-fade ul li').length, 3);
assert.equal($(fade.getElem('.mnu-fade ul li').get(0)).data('fade-layer'), 'layer2');
assert.equal($(fade.getElem('.mnu-fade ul li').get(1)).data('fade-layer'), 'layerA');
assert.equal($(fade.getElem('.mnu-fade ul li').get(2)).data('fade-layer'), 'layerB');
assert.equal($(fade.getElem('.mnu-fade ul li').get(0)).data('fade-layer'), 'layerA');
assert.equal($(fade.getElem('.mnu-fade ul li').get(1)).data('fade-layer'), 'layerB');
assert.equal($(fade.getElem('.mnu-fade ul li').get(2)).data('fade-layer'), 'layer2');
assert.equal(fade.getElem('.mnu-fade ol li').length, 1);
assert.equal(fade.getElem('.mnu-fade ol li').data('fade-layer'), 'layer1');
});
Expand Down

0 comments on commit 5376041

Please sign in to comment.