Skip to content
Browse files

split list icons respect data-icon Fixes: #3747

  • Loading branch information...
1 parent b9e8de5 commit dd3015c0d85c4f8a0eb1f91890d83fe4f242f256 @johnbender johnbender committed Mar 6, 2012
Showing with 34 additions and 2 deletions.
  1. +2 −2 js/jquery.mobile.listview.js
  2. +10 −0 tests/unit/listview/index.html
  3. +22 −0 tests/unit/listview/listview_core.js
View
4 js/jquery.mobile.listview.js
@@ -163,7 +163,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
if ( counter ) {
$list.find( ".ui-li-dec" ).remove();
}
-
+
if ( !o.theme ) {
o.theme = $.mobile.getInheritedTheme( this.element, "c" );
}
@@ -219,7 +219,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
corners: true,
theme: splittheme,
iconpos: "notext",
- icon: listspliticon || last.jqmData( "icon" ) || o.splitIcon
+ icon: icon || listspliticon || o.splitIcon
})
);
}
View
10 tests/unit/listview/index.html
@@ -332,5 +332,15 @@ <h2 id="qunit-userAgent"></h2>
</div>
</div>
+ <div data-nstest-role="page" id="split-list-icon">
+ <div data-nstest-role="content">
+ <ul data-nstest-role="listview">
+ <li data-nstest-icon="star"><a href="#">Star</a><a href="#">Star</a></li>
+ <li data-nstest-icon="plug"><a href="#">Plus</a><a href="#">Plus</a></li>
+ <li><a href="#">Default</a><a href="#">Default</a></li>
+ </ul>
+ </div>
+</div>
+
</body>
</html>
View
22 tests/unit/listview/listview_core.js
@@ -789,4 +789,26 @@
start
]);
});
+
+ asyncTest( "split list items respect the icon", function() {
+ $.testHelper.pageSequence([
+ function() {
+ $.mobile.changePage("#split-list-icon");
+ },
+
+ function() {
+ $.mobile.activePage.find("li").each(function(i, elem){
+ var $elem = $(elem),
+ icon = $elem.jqmData( "icon" ),
+ order = [ "star", "plug", "arrow-r" ];
+
+ same( $elem.find("span.ui-icon-" + order[i]).length, 1, "there should be one " + icon + " icon" );
+ });
+
+ window.history.back();
+ },
+
+ start
+ ]);
+ });
})(jQuery);

0 comments on commit dd3015c

Please sign in to comment.
Something went wrong with that request. Please try again.