mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Accordion: Removed change and changestart events. Fixes #6841 - Accordion: Remove changestart event. Fixes #6843 - Accordion: Remove change event.
This commit is contained in:
parent
8d35c03dfd
commit
bc44e61dd9
@ -10,7 +10,6 @@ var versions = {
|
||||
},
|
||||
tests = {
|
||||
"Accordion": "accordion/accordion.html",
|
||||
"Accordion_deprecated": "accordion/accordion_deprecated.html",
|
||||
"Autocomplete": "autocomplete/autocomplete.html",
|
||||
"Button": "button/button.html",
|
||||
"Core": "core/core.html",
|
||||
|
@ -5,9 +5,6 @@
|
||||
<title>jQuery UI Accordion Test Suite</title>
|
||||
|
||||
<script src="../../jquery.js"></script>
|
||||
<script>
|
||||
$.uiBackCompat = false;
|
||||
</script>
|
||||
<link rel="stylesheet" href="../../../external/qunit.css">
|
||||
<script src="../../../external/qunit.js"></script>
|
||||
<script src="../../jquery.simulate.js"></script>
|
||||
|
@ -1,22 +0,0 @@
|
||||
TestHelpers.commonWidgetTests( "accordion", {
|
||||
defaults: {
|
||||
active: 0,
|
||||
animate: {},
|
||||
collapsible: false,
|
||||
disabled: false,
|
||||
event: "click",
|
||||
header: "> li > :first-child,> :not(li):even",
|
||||
heightStyle: "auto",
|
||||
icons: {
|
||||
"activeHeader": "ui-icon-triangle-1-s",
|
||||
"header": "ui-icon-triangle-1-e"
|
||||
},
|
||||
|
||||
// callbacks
|
||||
activate: null,
|
||||
beforeActivate: null,
|
||||
change: null,
|
||||
changestart: null,
|
||||
create: null
|
||||
}
|
||||
});
|
@ -1,140 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion Test Suite</title>
|
||||
|
||||
<script src="../../jquery.js"></script>
|
||||
<link rel="stylesheet" href="../../../external/qunit.css">
|
||||
<script src="../../../external/qunit.js"></script>
|
||||
<script src="../../jquery.simulate.js"></script>
|
||||
<script src="../testsuite.js"></script>
|
||||
<script>
|
||||
TestHelpers.loadResources({
|
||||
css: [ "ui.core", "ui.accordion" ],
|
||||
js: [
|
||||
"ui/jquery.ui.core.js",
|
||||
"ui/jquery.ui.widget.js",
|
||||
"ui/jquery.ui.accordion.js"
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="accordion_test_helpers.js"></script>
|
||||
<script src="accordion_common_deprecated.js"></script>
|
||||
<script src="accordion_core.js"></script>
|
||||
<script src="accordion_events.js"></script>
|
||||
<script src="accordion_methods.js"></script>
|
||||
<script src="accordion_options.js"></script>
|
||||
<script src="accordion_deprecated.js"></script>
|
||||
|
||||
<script src="../swarminject.js"></script>
|
||||
<style>
|
||||
#list, #list1 *, #navigation, #navigation * {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
line-height: 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery UI Accordion Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
<div id="list1" class="foo">
|
||||
<h3 class="bar">There is one obvious advantage:</h3>
|
||||
<div class="foo">
|
||||
<p>
|
||||
You've seen it coming!
|
||||
<br>
|
||||
Buy now and get nothing for free!
|
||||
<br>
|
||||
Well, at least no free beer. Perhaps a bear, if you can afford it.
|
||||
</p>
|
||||
</div>
|
||||
<h3 class="bar">Now that you've got...</h3>
|
||||
<div class="foo">
|
||||
<p>
|
||||
your bear, you have to admit it!
|
||||
<br>
|
||||
No, we aren't <a href="#">selling bears</a>.
|
||||
</p>
|
||||
<p>
|
||||
We could talk about renting one.
|
||||
</p>
|
||||
</div>
|
||||
<h3 class="bar">Rent one bear, ...</h3>
|
||||
<div class="foo">
|
||||
<p>
|
||||
get two for three beer.
|
||||
</p>
|
||||
<p>
|
||||
And now, for something completely different.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="navigationWrapper">
|
||||
<ul id="navigation">
|
||||
<li>
|
||||
<h2><a href="?p=1.1.1">Guitar</a></h2>
|
||||
<ul>
|
||||
<li><a href="?p=1.1.1.1">Electric</a></li>
|
||||
<li><a href="?p=1.1.1.2">Acoustic</a></li>
|
||||
<li><a href="?p=1.1.1.3">Amps</a></li>
|
||||
<li><a href="?p=1.1.1.4">Effects</a></li>
|
||||
<li><a href="?p=1.1.1.5">Accessories</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2><a href="?p=1.1.2"><span>Bass</span></a></h2>
|
||||
<ul>
|
||||
<li><a href="?p=1.1.2.1">Electric</a></li>
|
||||
<li><a href="?p=1.1.2.2">Acoustic</a></li>
|
||||
<li><a href="?p=1.1.2.3">Amps</a></li>
|
||||
<li><a href="?p=1.1.2.4">Effects</a></li>
|
||||
<li><a href="?p=1.1.2.5">Accessories</a></li>
|
||||
<li><a href="?p=1.1.2.5">Accessories</a></li>
|
||||
<li><a href="?p=1.1.2.5">Accessories</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2><a href="?p=1.1.3">Drums</a></h2>
|
||||
<ul>
|
||||
<li><a href="?p=1.1.3.2">Acoustic</a></li>
|
||||
<li><a href="?p=1.1.3.3">Electronic</a></li>
|
||||
<li><a href="?p=1.1.3.6">Accessories</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<dl id="accordion-dl">
|
||||
<dt>
|
||||
Accordion Header 1
|
||||
</dt>
|
||||
<dd>
|
||||
Accordion Content 1
|
||||
</dd>
|
||||
<dt>
|
||||
Accordion Header 2
|
||||
</dt>
|
||||
<dd>
|
||||
Accordion Content 2
|
||||
</dd>
|
||||
<dt>
|
||||
Accordion Header 3
|
||||
</dt>
|
||||
<dd>
|
||||
Accordion Content 3
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,99 +0,0 @@
|
||||
(function( $ ) {
|
||||
|
||||
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||
state = TestHelpers.accordion.state;
|
||||
|
||||
module( "accordion (deprecated) - changestart/change events", setupTeardown() );
|
||||
|
||||
test( "changestart", function() {
|
||||
expect( 26 );
|
||||
var element = $( "#list1" ).accordion({
|
||||
active: false,
|
||||
collapsible: true
|
||||
}),
|
||||
headers = element.find( ".ui-accordion-header" ),
|
||||
content = element.find( ".ui-accordion-content" );
|
||||
|
||||
element.one( "accordionchangestart", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 0 );
|
||||
equal( ui.oldContent.length, 0 );
|
||||
equal( ui.newHeader.length, 1 );
|
||||
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
||||
equal( ui.newContent.length, 1 );
|
||||
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
||||
state( element, 0, 0, 0 );
|
||||
});
|
||||
element.accordion( "option", "active", 0 );
|
||||
state( element, 1, 0, 0 );
|
||||
|
||||
element.one( "accordionchangestart", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 1 );
|
||||
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
|
||||
equal( ui.oldContent.length, 1 );
|
||||
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
|
||||
equal( ui.newHeader.length, 1 );
|
||||
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
||||
equal( ui.newContent.length, 1 );
|
||||
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
||||
state( element, 1, 0, 0 );
|
||||
});
|
||||
headers.eq( 1 ).click();
|
||||
state( element, 0, 1, 0 );
|
||||
|
||||
element.one( "accordionchangestart", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 1 );
|
||||
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
|
||||
equal( ui.oldContent.length, 1 );
|
||||
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
||||
equal( ui.newHeader.length, 0 );
|
||||
equal( ui.newContent.length, 0 );
|
||||
state( element, 0, 1, 0 );
|
||||
});
|
||||
element.accordion( "option", "active", false );
|
||||
state( element, 0, 0, 0 );
|
||||
});
|
||||
|
||||
test( "change", function() {
|
||||
expect( 20 );
|
||||
var element = $( "#list1" ).accordion({
|
||||
active: false,
|
||||
collapsible: true
|
||||
}),
|
||||
headers = element.find( ".ui-accordion-header" ),
|
||||
content = element.find( ".ui-accordion-content" );
|
||||
|
||||
element.one( "accordionchange", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 0 );
|
||||
equal( ui.oldContent.length, 0 );
|
||||
equal( ui.newHeader.length, 1 );
|
||||
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
||||
equal( ui.newContent.length, 1 );
|
||||
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
||||
});
|
||||
element.accordion( "option", "active", 0 );
|
||||
|
||||
element.one( "accordionchange", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 1 );
|
||||
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
|
||||
equal( ui.oldContent.length, 1 );
|
||||
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
|
||||
equal( ui.newHeader.length, 1 );
|
||||
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
||||
equal( ui.newContent.length, 1 );
|
||||
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
||||
});
|
||||
headers.eq( 1 ).click();
|
||||
|
||||
element.one( "accordionchange", function( event, ui ) {
|
||||
equal( ui.oldHeader.length, 1 );
|
||||
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
|
||||
equal( ui.oldContent.length, 1 );
|
||||
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
||||
equal( ui.newHeader.length, 0 );
|
||||
equal( ui.newContent.length, 0 );
|
||||
});
|
||||
element.accordion( "option", "active", false );
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -17,7 +17,6 @@
|
||||
var params = [],
|
||||
suites = [
|
||||
"accordion/accordion.html",
|
||||
"accordion/accordion_deprecated.html",
|
||||
"autocomplete/autocomplete.html",
|
||||
"button/button.html",
|
||||
"core/core.html",
|
||||
|
@ -17,7 +17,6 @@
|
||||
var params = [],
|
||||
suites = [
|
||||
"accordion/accordion.html",
|
||||
"accordion/accordion_deprecated.html",
|
||||
"autocomplete/autocomplete.html",
|
||||
"button/button.html",
|
||||
"core/core.html",
|
||||
|
@ -7,7 +7,6 @@ var versions = [
|
||||
"git"
|
||||
],
|
||||
additionalTests = {
|
||||
accordion: [ "accordion_deprecated.html" ],
|
||||
position: [ "position_deprecated.html" ]
|
||||
};
|
||||
|
||||
|
38
ui/jquery.ui.accordion.js
vendored
38
ui/jquery.ui.accordion.js
vendored
@ -540,42 +540,4 @@ $.widget( "ui.accordion", {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// DEPRECATED
|
||||
if ( $.uiBackCompat !== false ) {
|
||||
// change events
|
||||
(function( $, prototype ) {
|
||||
$.extend( prototype.options, {
|
||||
change: null,
|
||||
changestart: null
|
||||
});
|
||||
|
||||
var _trigger = prototype._trigger;
|
||||
prototype._trigger = function( type, event, data ) {
|
||||
var ret = _trigger.apply( this, arguments );
|
||||
if ( !ret ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( type === "beforeActivate" ) {
|
||||
ret = _trigger.call( this, "changestart", event, {
|
||||
oldHeader: data.oldHeader,
|
||||
oldContent: data.oldPanel,
|
||||
newHeader: data.newHeader,
|
||||
newContent: data.newPanel
|
||||
});
|
||||
} else if ( type === "activate" ) {
|
||||
ret = _trigger.call( this, "change", event, {
|
||||
oldHeader: data.oldHeader,
|
||||
oldContent: data.oldPanel,
|
||||
newHeader: data.newHeader,
|
||||
newContent: data.newPanel
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
|
Loading…
Reference in New Issue
Block a user