Skip to content

Commit

Permalink
Add tests for iframe attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenj committed Dec 12, 2016
1 parent ef143e8 commit 64dc393
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/featherlight_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,24 @@ var stubAjaxLoad = function(content) {
expect($('.featherlight iframe')).to.have.css('width').equal('323px');
expect($('.featherlight iframe')).to.have.css('min-height').equal('212px');
});

describe('generates an iframe with tag attributes', function() {
it('adds `allowfullescreen` attribute', function() {
$('<a data-featherlight-iframe="http://www.apple.com" '+
'data-featherlight-iframe-allowfullscreen="true">').featherlight().click();

expect($('.featherlight iframe')).to.have.attr('src').equal('http://www.apple.com');
expect($('.featherlight iframe')).to.have.attr('allowfullscreen').equal('true');
});

it('does not add invalid attributes', function() {
$('<a data-featherlight-iframe="http://www.apple.com" '+
'data-featherlight-iframe-invalid="foo">').featherlight().click();

expect($('.featherlight iframe')).to.have.attr('src').equal('http://www.apple.com');
expect($('.featherlight iframe')).to.not.have.attr('allowfullscreen').equal('foo');
});
});
});

});
Expand Down

0 comments on commit 64dc393

Please sign in to comment.