Skip to content

Commit

Permalink
Add test for duplicate image [#89]
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Feb 19, 2015
1 parent db4c0d4 commit afff329
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/featherlight_gallery_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,32 @@ var expect = chai.expect;
});
});

describe('$.featherlightGallery', function() {
it ('does not get confused with same images', function(done) {
var imgs = '<img src="fixtures/photo.jpeg"/>' +
'<img src="fixtures/photo.jpeg"/>' +
'<img src="fixtures/photo.jpeg?direct_3"/>';
$.featherlightGallery($(imgs), { targetAttr: 'src' });
$.fx.off = false
patiently(done, [function(){
expect($('.featherlight img')).to.have.attr('src').match(/photo.jpeg$/);
$('.featherlight').trigger('next');
},
function(){
expect($('.featherlight img')).to.have.css('opacity').lessThan(1);
},
function(){
expect($('.featherlight img')).to.have.css('opacity').equal('1');
$('.featherlight').trigger('next');
},
function() {
expect($('.featherlight img')).to.have.attr('src').match(/direct_3$/);
$.fx.off = true;
}]);
});
});


it ('accepts config as data-attributes', function(done) {
var $cur;
$('#extra-test').featherlightGallery();
Expand Down

0 comments on commit afff329

Please # to comment.