Permalink
Browse files

[dialog unit tests] Test new option closeBtn

  • Loading branch information...
gabrielschulhof committed Nov 16, 2012
1 parent c32d94b commit 8bd31b5dd23a03cf79d4c9181ff611a3950dc508
Showing with 45 additions and 0 deletions.
  1. +32 −0 tests/unit/dialog/dialog_events.js
  2. +13 −0 tests/unit/dialog/index.html
@@ -38,6 +38,38 @@
]);
});
asyncTest( "Test option data-close-btn", function() {
expect( 5 );
$.testHelper.pageSequence([
function() {
// bring up the dialog
$( "#close-btn-test-link" ).click();
},
function() {
var a = $( "#close-btn-test .ui-header a" );
deepEqual( a.length, 0, "Initially, the dialog header has no anchor elements (option value 'none')" );
$( "#close-btn-test" ).dialog( "option", "closeBtn", "left" );
a = $( "#close-btn-test .ui-header a" );
deepEqual( a.length, 1, "The dialog header has eactly one anchor element when the option value is set to 'left'" );
ok( a.hasClass( "ui-btn-left" ), "The close button has class ui-btn-left when the closeBtn option is set to 'left'" );
$( "#close-btn-test" ).dialog( "option", "closeBtn", "right" );
a = $( "#close-btn-test .ui-header a" );
deepEqual( a.length, 1, "The dialog header has eactly one anchor element when the option value is set to 'right'" );
ok( a.hasClass( "ui-btn-right" ), "The close button has class ui-btn-right when the closeBtn option is set to 'right'" );
$( "#close-btn-test" ).dialog( "close" );
},
function() {
start();
}
]);
});
asyncTest( "clicking dialog 'Close' button twice in quick succession does not cause the browser history to retreat by two", function() {
var correctLocation;
@@ -45,6 +45,7 @@ <h2 id="qunit-userAgent"></h2>
<div id="mypage" data-nstest-role="page" data-nstest-theme="a">
<a href="#foo-dialog" id="foo-dialog-link" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog"></a>
<a href="#close-btn-test" id="close-btn-test-link" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog">Go</a>
<a href="#dialog-a" id="link-a" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog">no theme set</a>
<a href="#dialog-b" id="link-b" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog">data-theme set</a>
<a href="#dialog-c" id="link-c" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog">data-theme & data-nstest-overlay-theme set</a>
@@ -68,6 +69,18 @@ <h1>Dialog</h1>
</div>
</div>
<div id="close-btn-test" data-nstest-role="dialog" data-nstest-theme="b" data-nstest-close-btn="none">
<div data-nstest-role="header" data-nstest-position="inline">
<h1>Dialog</h1>
</div>
<div data-nstest-role="content" >
<a href="#" id="internal-link">foo</a>
</div>
<div data-nstest-role="footer">
footer
</div>
</div>
<div data-nstest-role="page" id="dialog-a">
<div data-nstest-role="header" data-nstest-position="inline">
<h1> No theme set </h1>

0 comments on commit 8bd31b5

Please sign in to comment.