diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-05-14 08:37:53 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-06-03 08:37:45 -0400 |
commit | d4719bf6160a0c99273abddc42e39a734e9943a2 (patch) | |
tree | e9dc48912370ecf7f781e1df554c23ed33cf52f8 /tests/unit | |
parent | c2224bf5dc418c84c185844611786b9ccfb869a7 (diff) | |
download | jquery-ui-d4719bf6160a0c99273abddc42e39a734e9943a2.tar.gz jquery-ui-d4719bf6160a0c99273abddc42e39a734e9943a2.zip |
Spinner: Deprecate _uiSpinnerHtml and _buttonHtml extension points
Fixes #11097
Closes gh-1560
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/spinner/common-deprecated.js | 35 | ||||
-rw-r--r-- | tests/unit/spinner/deprecated.html | 21 | ||||
-rw-r--r-- | tests/unit/spinner/deprecated.js | 41 |
3 files changed, 97 insertions, 0 deletions
diff --git a/tests/unit/spinner/common-deprecated.js b/tests/unit/spinner/common-deprecated.js new file mode 100644 index 000000000..2c40df76a --- /dev/null +++ b/tests/unit/spinner/common-deprecated.js @@ -0,0 +1,35 @@ +define( [ + "lib/common", + "ui/spinner" +], function( common ) { + +common.testWidget( "spinner", { + defaults: { + classes: { + "ui-spinner": "ui-corner-all", + "ui-spinner-up": "ui-corner-tr", + "ui-spinner-down": "ui-corner-br" + }, + culture: null, + disabled: false, + icons: { + down: "ui-icon-triangle-1-s", + up: "ui-icon-triangle-1-n" + }, + incremental: true, + max: null, + min: null, + numberFormat: null, + page: 10, + step: 1, + + // callbacks + change: null, + create: null, + spin: null, + start: null, + stop: null + } +}); + +} ); diff --git a/tests/unit/spinner/deprecated.html b/tests/unit/spinner/deprecated.html new file mode 100644 index 000000000..a6c249a17 --- /dev/null +++ b/tests/unit/spinner/deprecated.html @@ -0,0 +1,21 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Spinner Test Suite</title> + + <script src="../../../external/requirejs/require.js"></script> + <script src="../../lib/css.js" data-modules="core button spinner"></script> + <script src="../../lib/bootstrap.js" data-widget="spinner" data-deprecated="true"></script> +</head> +<body> + +<div id="qunit"></div> +<div id="qunit-fixture"> + +<input id="spin" class="foo"> +<input id="spin2" value="2"> + +</div> +</body> +</html> diff --git a/tests/unit/spinner/deprecated.js b/tests/unit/spinner/deprecated.js new file mode 100644 index 000000000..c45a053fd --- /dev/null +++ b/tests/unit/spinner/deprecated.js @@ -0,0 +1,41 @@ +define( [ + "jquery", + "ui/spinner" +], function( $ ) { + +var originalSpinner = $.ui.spinner.prototype; +module( "spinner: deprecated", { + setup: function() { + $.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>"; + } + } ); + }, + + teardown: function() { + $.ui.spinner.prototype = originalSpinner; + } +} ); + +test( "markup structure - custom", function( 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" ); +} ); + +} ); |