slider-tests.js: equal assertion have been changed with ok, slider test html page structure have been changed
collapsible-tests.js: expected result have been modified
button-tests.js: parameter and if-else statement have been added
Change-Id: I2641885646faf6dbfe6b5bed9d6b4a4947ac4779
module ("button") ;
- var unit_button = function ( widget, type ) {
+ var unit_button = function ( widget, type, text ) {
var buttonClassPrefix = "ui-btn",
buttonText = type,
icon,
// Text Trim, CausejQueryMobile ( JQM ) 1.1 forced to add -"\u00a0"in buttonIcon ( ButtonMarkup )
// JQM 1.1 buttonMarkup code :
// - if ( buttonIcon ) buttonIcon.appendChild ( document.createTextNode ("\u00a0") ) ;
- equal ( widget.text ( ).trim ( ) , buttonText , "Button Text") ;
+ if ( buttonText == "") {
+ equal ( widget.text ( ).trim ( ) , text , "Button Text icon only") ;
+ } else {
+ equal ( widget.text ( ).trim ( ) , buttonText , "Button Text");
+ }
icon = widget.jqmData ("icon") ;
if ( icon !== undefined ) {
ok ( widget.children ( ).children ( ).hasClass ("ui-icon-" + icon ) , "Style - Button Icon") ;
} ) ;
test ("Button - Inline, Only Icon ( Reveal )", function ( ) {
- unit_button ( $("#button-4") , "Non Text Button") ;
+ unit_button ( $("#button-4") , "Non Text Button", "reveal") ;
} ) ;
test ("Button - Inline, Only Icon ( Send ) , circle", function ( ) {
- unit_button ( $("#button-5") , "Non Text Button") ;
+ unit_button ( $("#button-5") , "Non Text Button", "send") ;
} ) ;
test ("Button - Inline, Only Icon ( Favorite ) , nobackground", function ( ) {
- unit_button ( $("#button-6") , "Non Text Button") ;
+ unit_button ( $("#button-6") , "Non Text Button", "favorite") ;
} ) ;
test ("Button", function ( ) {
markup = '<div data-role = "button" id = "button-4">Non Text Button Dynamic</div>';
$('#checkboxpage').find (":jqmData(role=contents)").append ( markup ) ;
$('#checkboxpage').find (":jqmData(role=contents)").trigger ('create') ;
- unit_button ( $("#button-4") , "Non Text Button Dynamic") ;
+ unit_button ( $("#button-4") , "Non Text Button Dynamic", "reveal") ;
} ) ;
markup = '<div data-role = "button" id = "button-5">Non Text Button Dynamic</div>';
$('#checkboxpage').find (":jqmData(role=contents)").append ( markup ) ;
$('#checkboxpage').find (":jqmData(role=contents)").trigger ('create') ;
- unit_button ( $("#button-5") , "Non Text Button Dynamic") ;
+ unit_button ( $("#button-5") , "Non Text Button Dynamic", "send") ;
} ) ;
markup = '<div data-role = "button" id = "button-6">Non Text Button Dynamic</div>';
$('#checkboxpage').find (":jqmData(role=contents)").append ( markup ) ;
$('#checkboxpage').find (":jqmData(role=contents)").trigger ('create') ;
- unit_button ( $("#button-6") , "Non Text Button Dynamic") ;
+ unit_button ( $("#button-6") , "Non Text Button Dynamic", "favorite") ;
} ) ;
equal( widget.hasClass('ui-collapsible'), true, "Markup check") ;
/* Check Option */
- equal( obj_collapse.options.expandCueText, " click to expand contents", "Collapsed test -> expandCueText");
- equal( obj_collapse.options.collapseCueText, " click to collapse contents", "Collapsed test -> collapseCueText");
+ equal( obj_collapse.options.expandCueText, " Expandable list, tap to open list", "Collapsed test -> expandCueText");
+ equal( obj_collapse.options.collapseCueText, " Expandable list, tap to close list", "Collapsed test -> collapseCueText");
equal( obj_collapse.options.collapsed, true, "Collapsed test -> collapsed");
equal( obj_collapse.options.heading, "h1,h2,h3,h4,h5,h6,legend,li", "Collapsed test -> heading");
equal( obj_collapse.options.theme, 's', "Collapsed test -> theme");
</script>
<link rel="stylesheet" href="../../../libs/js/jquery-mobile-1.2.0/external/qunit.css" />
-
<script src="../../../libs/js/jquery-mobile-1.2.0/external/qunit.js"></script>
<script src="slider-tests.js"></script>
</head>
<body>
-
<h1 id="qunit-header">Slider</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
-
<div data-role="page" id="sliderpage1">
<div data-role="header" data-position="fixed">
<h1>Slider</h1>
</div>
<div data-role="content">
<input id="slider0" data-popup="false" type="range" name="slider" value="50" min="0" max="100"></input>
- </div>
- </div>
-
- <div data-role="page" id="sliderpage2">
- <div data-role="header" data-position="fixed">
- <h1>Slider</h1>
- </div>
- <div data-role="content">
<input id="slider1" data-popup="false" type="range" name="slider" value="5" min="0" max="10" data-icon="volume"></input>
</div>
</div>
</div>
-
</body>
</html>
equal( handle.attr("aria-valuemin" ), widget.attr("min" ), "Paramter : min" );
equal( handle.attr("aria-valuemax" ), widget.attr("max" ), "Paramter : max" );
- equal( parseInt( handle.css("left") ), handle_left( widget, slider ), "Handle Location: Default" );
+ ok( Math.abs(parseInt( handle.css("left") ) - handle_left( widget, slider ) ) <= 1, "Handle Location: Default" );
/* Check APIs */
widget.val( random_move( widget.attr("min" ), widget.attr("max" ) ) );
widget.trigger("change" );
- equal( parseInt( handle.css("left") ), handle_left( widget, slider ), "Handle Location: Moved" );
+ ok( Math.abs(parseInt( handle.css("left") ) - handle_left( widget, slider ) ) <= 1, "Handle Location: Moved" );
+
if ( widget.jqmData('popup') == true ) {
popup = slider.find(".ui-slider-handle-press" );
ok( popup, "Popup present" );
};
+ $('#sliderpage1').page( ) ;
+
test( "normal slider", function ( ) {
- $('#sliderpage1').page( ) ;
unit_slider( $("#slider0" ) );
} );
test( "icon slider", function ( ) {
- $('#sliderpage2').page( ) ;
unit_slider( $("#slider1" ) );
} );
+
} );