aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/spinner/deprecated.js
blob: 79700d11608011a6bf10a56e8f71945197406ade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
define( [
	"qunit",
	"jquery",
	"lib/helper",
	"ui/widgets/spinner"
], function( QUnit, $, helper ) {
"use strict";

var originalSpinner = $.ui.spinner.prototype;
QUnit.module( "spinner: deprecated", {
	beforeEach: function() {
		$.widget( "ui.spinner", $.ui.spinner, {
			_uiSpinnerHtml: function() {
				return "<span class='spin-wrap'>";
			},

			_buttonHtml: function() {
				return "" +
					"<a class='spin-up'>" +
						"<span>&#9650;</span>" +
					"</a>" +
					"<a>" +
						"<span>&#9660;</span>" +
					"</a>";
			}
		} );
	},

	afterEach: function() {
		$.ui.spinner.prototype = originalSpinner;
		return helper.moduleAfterEach.apply( this, arguments );
	}
} );

QUnit.test( "markup structure - custom", function( assert ) {
	assert.expect( 2 );
	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" );
} );

} );