| 1 | define( [ |
| 2 | "qunit", |
| 3 | "jquery", |
| 4 | "lib/helper", |
| 5 | "ui/widgets/spinner" |
| 6 | ], function( QUnit, $, helper ) { |
| 7 | "use strict"; |
| 8 | |
| 9 | var originalSpinner = $.ui.spinner.prototype; |
| 10 | QUnit.module( "spinner: deprecated", { |
| 11 | beforeEach: function() { |
| 12 | $.widget( "ui.spinner", $.ui.spinner, { |
| 13 | _uiSpinnerHtml: function() { |
| 14 | return "<span class='spin-wrap'>"; |
| 15 | }, |
| 16 | |
| 17 | _buttonHtml: function() { |
| 18 | return "" + |
| 19 | "<a class='spin-up'>" + |
| 20 | "<span>▲</span>" + |
| 21 | "</a>" + |
| 22 | "<a>" + |
| 23 | "<span>▼</span>" + |
| 24 | "</a>"; |
| 25 | } |
| 26 | } ); |
| 27 | }, |
| 28 | |
| 29 | afterEach: function() { |
| 30 | $.ui.spinner.prototype = originalSpinner; |
| 31 | return helper.moduleAfterEach.apply( this, arguments ); |
| 32 | } |
| 33 | } ); |
| 34 | |
| 35 | QUnit.test( "markup structure - custom", function( assert ) { |
| 36 | assert.expect( 2 ); |
| 37 | var element = $( "#spin" ).spinner(), |
| 38 | spinner = element.spinner( "widget" ), |
| 39 | up = spinner.find( ".ui-spinner-up" ); |
| 40 | |
| 41 | assert.hasClasses( spinner, "ui-spinner ui-widget ui-widget-content spin-wrap", "_uiSpinnerHtml() overides default markup" ); |
| 42 | assert.hasClasses( up, "ui-spinner-button ui-spinner-up ui-widget spin-up", "_ButtonHtml() overides default markup" ); |
| 43 | } ); |
| 44 | |
| 45 | } ); |