});
test("{ active: Number }", function() {
- ok(false, 'missing test - untested code is broken code');
+ expect(4);
+ $("#list1").accordion({
+ active: 0
+ });
+ equals( $("#list1").accordion('option', 'active'), 0);
+
+ $("#list1").accordion('option', 'active', 1);
+ equals( $("#list1").accordion('option', 'active'), 1);
+
+ $('.ui-accordion-header:eq(2)', '#list1').click();
+ equals( $("#list1").accordion('option', 'active'), 2);
+
+ $("#list1").accordion('activate', 0);
+ equals( $("#list1").accordion('option', 'active'), 0);
});
test("{ animated: false }, default", function() {
$.widget.prototype._setData.apply(this, arguments);
+ if (key == "active") {
+ this.activate(value);
+ }
if (key == "icons") {
this._destroyIcons();
if (value) {
},
activate: function(index) {
+ this.options.active = index;
// call clickHandler with custom event
var active = this._findActive(index)[0];
this._clickHandler({ target: active }, active);
// get the click target
var clicked = $(event.currentTarget || target);
var clickedIsActive = clicked[0] == this.active[0];
+
+ o.active = $('.ui-accordion-header', this.element).index(clicked);
// if animations are still active, or the active header is the target, ignore click
if (this.running || (!o.collapsible && clickedIsActive)) {