Added tests

This commit is contained in:
Pascal Rettig 2011-09-25 22:15:56 -04:00
parent 423608a0b8
commit 4b7fe3358d
3 changed files with 90 additions and 1 deletions

10
test/fixtures/iframe_simple.html vendored Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
Simple Iframe
</body>
</html>

32
test/fixtures/iframes.html vendored Normal file
View file

@ -0,0 +1,32 @@
<div class="deck-container">
<div class="slide1"></div>
<div class="slide2 slide3 slide4">
</div>
<div class="slide5">
<iframe src='iframe_simple.html'></iframe>
</div>
<div class='slide6'>
</div>
<div class="slide7">
<iframe></iframe>
</div>
<div class="slide8 slide9 slide10"></div>
<p class="deck-status">
<span class="deck-status-current"></span>
/
<span class="deck-status-total"></span>
</p>
<form action="." method="get" class="goto-form">
<label for="goto-slide">Go to slide:</label>
<input type="number" name="slidenum" id="goto-slide" value="">
<input type="submit" value="Go">
</form>
</div>

View file

@ -337,4 +337,51 @@ describe('Deck JS', function() {
expect($('.slide4').not('.slide6')).not.toHaveClass(defaults.classes.next);
});
});
});
describe('iframes', function() {
beforeEach(function() {
loadFixtures('iframes.html');
if (Modernizr.history) {
history.replaceState({}, "", "#")
}
$.deck([
'.slide1',
'.slide2',
'.slide3',
'.slide4',
'.slide5',
'.slide6',
'.slide7',
'.slide8',
'.slide9',
'.slide10',
]);
});
it('should support remove and return iframe srcs', function() {
$.deck('go', 4);
expect($.deck('getSlide').find('iframe').attr('src')).toEqual('iframe_simple.html');
$.deck('next');
expect($('.slide5').find('iframe').attr('src')).toEqual('');
$.deck('prev');
expect($('.slide5').find('iframe').attr('src')).toEqual('iframe_simple.html');
});
it('should support iframes without sources', function() {
$.deck('go', 5);
expect($.deck('getSlide')).toHaveClass('slide6');
expect($.deck('getSlide').find('iframe').attr('src')).toBeUndefined();
$.deck('next');
expect($.deck('getSlide')).toHaveClass('slide7');
});
});
});