https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113811

Revision: 113811
Author:   jdlrobson
Date:     2012-03-14 15:18:16 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
define correct behaviour for revealing an already open section

previously clicking a hash link was toggling the section
when it should always reveal

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/javascripts/toggle.js
    trunk/extensions/MobileFrontend/tests/js/test_toggle.js

Modified: trunk/extensions/MobileFrontend/javascripts/toggle.js
===================================================================
--- trunk/extensions/MobileFrontend/javascripts/toggle.js       2012-03-14 
13:35:13 UTC (rev 113810)
+++ trunk/extensions/MobileFrontend/javascripts/toggle.js       2012-03-14 
15:18:16 UTC (rev 113811)
@@ -62,7 +62,7 @@
                                !u(p).hasClass( 'section_heading' ) ) {
                                p = p.parentNode;
                        }
-                       if ( p && p.style.display !== 'block' ) {
+                       if ( p && ! u( p ).hasClass( 'openSection' ) ) {
                                section_idx = parseInt( p.id.split( '_' )[1], 
10 );
                                wm_toggle_section( section_idx );
                        }

Modified: trunk/extensions/MobileFrontend/tests/js/test_toggle.js
===================================================================
--- trunk/extensions/MobileFrontend/tests/js/test_toggle.js     2012-03-14 
13:35:13 UTC (rev 113810)
+++ trunk/extensions/MobileFrontend/tests/js/test_toggle.js     2012-03-14 
15:18:16 UTC (rev 113811)
@@ -37,13 +37,10 @@
        strictEqual($("#section_1 .show").is(":visible"), true, "check show 
button now visible");
 });
 
-test("wm_reveal_for_hash", function() {
+test("clicking a hash link to reveal an already open section", function() {
+       strictEqual($("#section_1").hasClass("openSection"), true, "check 
section is open");
        MFE.toggle.wm_reveal_for_hash("#First_Section");
-       applyCss();
-       strictEqual($("#content_1").is(":visible"), true, "check content is 
visible on a toggle");
-       strictEqual($("#anchor_1").is(":visible"), true, "check anchor is 
visible on toggle");
-       strictEqual($("#section_1 .hide").is(":visible"), true, "check hide 
button now visible");
-       strictEqual($("#section_1 .show").is(":visible"), false, "check show 
button now hidden");
+       strictEqual($("#section_1").hasClass("openSection"), true, "check 
section is still open");
 });
 
 test("wm_reveal_for_hash", function() {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to