Permalink
Browse files

Toolbar: Leave anchors marked data-role="none" unenhanced

Fixes gh-6875
  • Loading branch information...
gabrielschulhof committed Jan 11, 2014
1 parent aea0f99 commit eb8d2baa231b5f7f8f6df2b68a2f11fffb371a0d
Showing with 20 additions and 4 deletions.
  1. +4 −1 js/widgets/toolbar.js
  2. +8 −3 tests/integration/toolbar/index.html
  3. +8 −0 tests/integration/toolbar/toolbar_core.js
View
@@ -95,7 +95,10 @@ define( [
// Deprecated in 1.4. As from 1.5 button classes have to be present in the markup.
_btnMarkup: function() {
this.element.children( "a" ).attr( "data-" + $.mobile.ns + "role", "button" );
this.element
.children( "a" )
.filter( ":not([data-" + $.mobile.ns + "role='none'])" )
.attr( "data-" + $.mobile.ns + "role", "button" );
this.element.trigger( "create" );
},
// Deprecated in 1.4. As from 1.5 ui-btn-left/right classes have to be present in the markup.
@@ -14,14 +14,15 @@
<script>
$.testHelper.asyncLoad([
[
"widgets/toolbar"
"widgets/toolbar",
"jquery.mobile.buttonMarkup"
],
[ "jquery.mobile.init" ],
[ "toolbar_core.js" ]
]);
</script>
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
<link rel="stylesheet" href="../../../external/qunit/qunit.css"/>
<link rel="stylesheet" href="../../jqm-tests.css"/>
@@ -32,7 +33,11 @@
<div id="qunit"></div>
<div data-nstest-role="page">
<div data-role="content">
<div data-nstest-role="header" id="start-page-header">
<a href="#">Left Link</a>
<a href="#" data-nstest-role="none">Right Link</a>
</div>
<div class="ui-content">
<a href="#page2" id="go-to-page2">Go</a>
</div>
</div>
@@ -2,6 +2,14 @@
module( "Toolbar" );
test( "Links are auto-enhanced, unless data-role is set to 'none'", function() {
var leftLink = $( "#start-page-header a:first" ),
rightLink = $( "#start-page-header a:last" );
deepEqual( leftLink.hasClass( "ui-btn" ), true, "Left link has been enhanced" );
deepEqual( rightLink.hasClass( "ui-btn" ), false, "Right link has not been enhanced" );
});
asyncTest( "Back button appears correctly", function() {
expect( 2 );

0 comments on commit eb8d2ba

Please sign in to comment.