]> source.dussan.org Git - jquery-ui.git/commitdiff
Accordion: Added .ui-accordion-heading class to header's first child. Fixes #6743...
authorAlex Dovenmuehle <adovenmuehle@gmail.com>
Mon, 6 Dec 2010 05:56:19 +0000 (00:56 -0500)
committerScott González <scott.gonzalez@gmail.com>
Fri, 10 Dec 2010 19:54:50 +0000 (14:54 -0500)
tests/unit/accordion/accordion.html
tests/unit/accordion/accordion_core.js
tests/unit/accordion/accordion_methods.js
tests/unit/accordion/accordion_options.js
themes/base/jquery.ui.accordion.css
ui/jquery.ui.accordion.js

index b27de095d76473ea6b32df03e861d0e43b4c5bf8..61d1683864192708b86fafa861866a8e6aecd2f6 100644 (file)
@@ -64,7 +64,7 @@
 
        <div>
                <div id="list1" class="foo">
-               <a class="bar">There is one obvious advantage:</a>
+               <h3 class="bar"><a class="anchor">There is one obvious advantage:</a></h3>
                <div class="foo">
                    <p>
                        You've seen it coming!
@@ -74,7 +74,7 @@
                        Well, at least no free beer. Perhaps a bear, if you can afford it.
                    </p>
                </div>
-               <a class="bar">Now that you've got...</a>
+               <h3 class="bar"><a class="anchor">Now that you've got...</a></h3>
                <div class="foo">
                    <p>
                        your bear, you have to admit it!
@@ -85,7 +85,7 @@
                        We could talk about renting one.
                    </p>
                </div>
-               <a class="bar">Rent one bear, ...</a>
+               <h3 class="bar"><a class="anchor">Rent one bear, ...</a></h3>
                <div class="foo">
                    <p>
                        get two for three beer.
index 2bef43149b9e156b653a583f9da47ccee94e116f..640427e2ec1331d168de568d58c365eb35179b64 100644 (file)
@@ -13,6 +13,13 @@ test("handle click on header-descendant", function() {
        state(ac, 0, 1, 0);
 });
 
+test("ui-accordion-heading class added to headers anchor", function() {
+       expect(1);
+       var ac = $("#list1").accordion();
+       var anchors = $(".ui-accordion-heading");
+       equals( anchors.length, "3"); 
+});
+
 test("accessibility", function () {
        expect(9);
        var ac = $('#list1').accordion().accordion("activate", 1);
index 96688b59edfdab77455f1d65245d62b7583873ab..ed5cb37b6c28ee455d4276a230febd510cb2da29 100644 (file)
@@ -95,7 +95,7 @@ test("activate, boolean, collapsible: false", function() {
 });
 
 test("activate, string expression", function() {
-       var ac = $('#list1').accordion({ active: "a:last" });
+       var ac = $('#list1').accordion({ active: "h3:last" });
        state(ac, 0, 0, 1);
        ac.accordion("activate", ":first");
        state(ac, 1, 0, 0);
@@ -106,11 +106,11 @@ test("activate, string expression", function() {
 });
 
 test("activate, jQuery or DOM element", function() {
-       var ac = $('#list1').accordion({ active: $("#list1 a:last") });
+       var ac = $('#list1').accordion({ active: $("#list1 h3:last") });
        state(ac, 0, 0, 1);
-       ac.accordion("activate", $("#list1 a:first"));
+       ac.accordion("activate", $("#list1 h3:first"));
        state(ac, 1, 0, 0);
-       ac.accordion("activate", $("#list1 a")[1]);
+       ac.accordion("activate", $("#list1 h3")[1]);
        state(ac, 0, 1, 0);
 });
 
index 499fec383557ddf662711f4e16351ea7f35f49c1..291deb2147c31c697a678ded149a62da92273591 100644 (file)
@@ -13,28 +13,28 @@ test("{ active: first child }, default", function() {
 
 test("{ active: Selector }", function() {
        var ac = $("#list1").accordion({
-               active: "a:last"
+               active: "h3:last"
        });
        state(ac, 0, 0, 1);
-       ac.accordion('option', 'active', "a:eq(1)");
+       ac.accordion('option', 'active', "h3:eq(1)");
        state(ac, 0, 1, 0);
 });
 
 test("{ active: Element }", function() {
        var ac = $("#list1").accordion({
-               active: $("#list1 a:last")[0]
+               active: $("#list1 h3:last")[0]
        });
        state(ac, 0, 0, 1);
-       ac.accordion('option', 'active', $("#list1 a:eq(1)")[0]);
+       ac.accordion('option', 'active', $("#list1 h3:eq(1)")[0]);
        state(ac, 0, 1, 0);
 });
 
 test("{ active: jQuery Object }", function() {
        var ac = $("#list1").accordion({
-               active: $("#list1 a:last")
+               active: $("#list1 h3:last")
        });
        state(ac, 0, 0, 1);
-       ac.accordion('option', 'active', $("#list1 a:eq(1)"));
+       ac.accordion('option', 'active', $("#list1 h3:eq(1)"));
        state(ac, 0, 1, 0);
 });
 
index 6edf6e5ef967e644e857931bb22d7cb5b8459f1d..23446e1f64ed4d5c41bb3ba5a6445d07d7c0b184 100644 (file)
@@ -12,8 +12,8 @@
 .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
 .ui-accordion .ui-accordion-li-fix { display: inline; }
 .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
-.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
-.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-heading { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-heading { padding-left: 2.2em; }
 .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
 .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
-.ui-accordion .ui-accordion-content-active { display: block; }
\ No newline at end of file
+.ui-accordion .ui-accordion-content-active { display: block; }
index 96a69d4f3c6da5b452064fd6c64bb434cbd32c1b..0f404b90c76df1409751cd398ea6a4979f0972b8 100644 (file)
@@ -75,6 +75,7 @@ $.widget( "ui.accordion", {
 
                self.headers.next()
                        .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
+               self.headers.find( ":first-child" ).addClass( "ui-accordion-heading" );
 
                if ( options.navigation ) {
                        var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
@@ -177,6 +178,7 @@ $.widget( "ui.accordion", {
 
                this.headers.find( "a" ).removeAttr( "tabIndex" );
                this._destroyIcons();
+               this.headers.find( "a:first-child" ).removeClass( "ui-accordion-heading" );
                var contents = this.headers.next()
                        .css( "display", "" )
                        .removeAttr( "role" )