Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit a80e4c3

Browse files
committed
test that closestPageData works as expected
1 parent 978762d commit a80e4c3

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/unit/core/core.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,18 @@
145145
same( $("#encoded").getEncodedText(), "foo>");
146146
same( $("#unencoded").getEncodedText(), "foo");
147147
});
148+
149+
test( "closestPageData returns the parent's page data", function() {
150+
var pageChild = $( "#page-child" );
151+
152+
$( "#parent-page" ).data( "page", { foo: "bar" } );
153+
same( pageChild.closestPageData().foo, "bar" );
154+
});
155+
156+
test( "closestPageData returns the parent dialog's page data", function() {
157+
var dialogChild = $( "#dialog-child" );
158+
159+
$( "#parent-dialog" ).data( "page", { foo: "bar" } );
160+
same( dialogChild.closestPageData().foo, "bar" );
161+
});
148162
})(jQuery);

tests/unit/core/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ <h2 id="qunit-userAgent"></h2>
3535
<div id="dependent"></div>
3636
<div id="encoded">foo&gt;</div>
3737
<div id="unencoded"><script>foo</script></div>
38+
39+
<div id="parent-page" data-nstest-role="page">
40+
<div id="page-child"></div>
41+
</div>
42+
43+
<div id="parent-dialog" data-nstest-role="dialog">
44+
<div id="dialog-child"></div>
45+
</div>
3846
</div>
3947
</body>
4048
</html>

0 commit comments

Comments
 (0)