2015-05-14 12:37:53 +00:00
|
|
|
define( [
|
2016-04-06 13:26:05 +00:00
|
|
|
"qunit",
|
2015-05-14 12:37:53 +00:00
|
|
|
"jquery",
|
2015-07-15 02:10:12 +00:00
|
|
|
"ui/widgets/spinner"
|
2016-04-06 13:26:05 +00:00
|
|
|
], function( QUnit, $ ) {
|
2015-05-14 12:37:53 +00:00
|
|
|
|
|
|
|
var originalSpinner = $.ui.spinner.prototype;
|
2016-04-06 13:26:05 +00:00
|
|
|
QUnit.module( "spinner: deprecated", {
|
|
|
|
beforeEach: function() {
|
2015-05-14 12:37:53 +00:00
|
|
|
$.widget( "ui.spinner", $.ui.spinner, {
|
|
|
|
_uiSpinnerHtml: function() {
|
|
|
|
return "<span class='spin-wrap'>";
|
|
|
|
},
|
|
|
|
|
|
|
|
_buttonHtml: function() {
|
|
|
|
return "" +
|
|
|
|
"<a class='spin-up'>" +
|
|
|
|
"<span>▲</span>" +
|
|
|
|
"</a>" +
|
|
|
|
"<a>" +
|
|
|
|
"<span>▼</span>" +
|
|
|
|
"</a>";
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
},
|
|
|
|
|
2016-04-06 13:26:05 +00:00
|
|
|
afterEach: function() {
|
2015-05-14 12:37:53 +00:00
|
|
|
$.ui.spinner.prototype = originalSpinner;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2016-04-06 13:26:05 +00:00
|
|
|
QUnit.test( "markup structure - custom", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2015-05-14 12:37:53 +00:00
|
|
|
var element = $( "#spin" ).spinner(),
|
|
|
|
spinner = element.spinner( "widget" ),
|
|
|
|
up = spinner.find( ".ui-spinner-up" );
|
|
|
|
|
|
|
|
assert.hasClasses( spinner, "ui-spinner ui-widget ui-widget-content spin-wrap", "_uiSpinnerHtml() overides default markup" );
|
|
|
|
assert.hasClasses( up, "ui-spinner-button ui-spinner-up ui-widget spin-up", "_ButtonHtml() overides default markup" );
|
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|