test that closestPageData works as expected

This commit is contained in:
John Bender 2011-12-09 12:31:28 -08:00
parent 978762dc67
commit a80e4c3b4c
2 changed files with 22 additions and 0 deletions

View file

@ -145,4 +145,18 @@
same( $("#encoded").getEncodedText(), "foo>");
same( $("#unencoded").getEncodedText(), "foo");
});
test( "closestPageData returns the parent's page data", function() {
var pageChild = $( "#page-child" );
$( "#parent-page" ).data( "page", { foo: "bar" } );
same( pageChild.closestPageData().foo, "bar" );
});
test( "closestPageData returns the parent dialog's page data", function() {
var dialogChild = $( "#dialog-child" );
$( "#parent-dialog" ).data( "page", { foo: "bar" } );
same( dialogChild.closestPageData().foo, "bar" );
});
})(jQuery);

View file

@ -35,6 +35,14 @@
<div id="dependent"></div>
<div id="encoded">foo&gt;</div>
<div id="unencoded"><script>foo</script></div>
<div id="parent-page" data-nstest-role="page">
<div id="page-child"></div>
</div>
<div id="parent-dialog" data-nstest-role="dialog">
<div id="dialog-child"></div>
</div>
</div>
</body>
</html>