Skip to content

Commit

Permalink
Close #62 - Should handle pages that does not hide on URL changes
Browse files Browse the repository at this point in the history
  • Loading branch information
finnsson committed Nov 7, 2012
1 parent 15af04b commit d8e48b3
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions test/should_display_multiple_pages_using_url_toggle_show.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<title>Should display multiple pages using URL toggle none</title>
<script type="text/javascript" src="../lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../lib/underscore-min.js"></script>
<script type="text/javascript" src="../lib/knockout-2.1.0.js"></script>
<script type="text/javascript" src="../lib/jquery.ba-hashchange.min.js"></script>
<script type="text/javascript" src="../pager.js"></script>

<link rel="stylesheet" href="../lib/qunit.css"/>
</head>
<body>

<div id="qunit"></div>

<div data-bind="page: {id: 'a', urlToggle: 'none'}">
<span id="hej">Hej</span>
</div>

<div data-bind="page: {id: 'b', urlToggle: 'none'}">
<span id="hola">Hola</span>
</div>

<div data-bind="page: {id: 'c', urlToggle: 'none'}">
<span id="hi">Hi</span>
</div>

<div data-bind="page: {id: 'c'}">
<span id="eho">Eho</span>
</div>

<script type="text/javascript">


var viewModel = {
};

pager.extendWithPage(viewModel);
ko.applyBindings(viewModel);

pager.startHashChange();
</script>

<script type="text/javascript" src="../lib/qunit-until.js"></script>
<script type="text/javascript" src="../lib/qunit.js"></script>

<script type="text/javascript">

asyncTest("Should display multiple pages using URL toggle none", function () {

assert.equal($('#hej').is(':visible'), true, "hej should be visible");
assert.equal($('#hola').is(':visible'), true, "hola should be visible");
assert.equal($('#hi').is(':visible'), true, "hi should be visible");
assert.equal($('#eho').is(':visible'), false, "eho should be hidden");

location.hash = '#c';

until(function() {
return $('#eho').is(':visible');
}, function() {
assert.equal($('#hej').is(':visible'), true, "hej should be visible");
assert.equal($('#hola').is(':visible'), true, "hola should be visible");
assert.equal($('#hi').is(':visible'), true, "hi should be visible");
assert.equal($('#eho').is(':visible'), false, "eho should be visible");

});

start();

});
</script>


</body>
</html>

0 comments on commit d8e48b3

Please sign in to comment.