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

Commit

Permalink
split list icons respect data-icon Fixes: #3747
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbender committed Mar 8, 2012
1 parent d6e9fe5 commit ff80fae
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/jquery.mobile.listview.js
Expand Up @@ -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" );
}
Expand Down Expand Up @@ -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
})
);
}
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/listview/index.html
Expand Up @@ -332,6 +332,7 @@ <h1>Basic List View</h1>
</div>
</div>


<div id="list-inset-filter-prototype" data-nstest-theme="b">
<ul data-nstest-role="listview" data-nstest-filter="true">
<li>foo</li>
Expand All @@ -345,5 +346,17 @@ <h1>Basic List View</h1>
<li>bar</li>
</ul>
</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>
23 changes: 23 additions & 0 deletions tests/unit/listview/listview_core.js
Expand Up @@ -832,4 +832,27 @@
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 ff80fae

Please sign in to comment.