r113811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113810‎ | r113811 | r113812 >
Date:15:18, 14 March 2012
Author:jdlrobson
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/extensions/MobileFrontend/tests/js/test_toggle.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/tests/js/test_toggle.js
@@ -37,13 +37,10 @@
3838 strictEqual($("#section_1 .show").is(":visible"), true, "check show button now visible");
3939 });
4040
41 -test("wm_reveal_for_hash", function() {
 41+test("clicking a hash link to reveal an already open section", function() {
 42+ strictEqual($("#section_1").hasClass("openSection"), true, "check section is open");
4243 MFE.toggle.wm_reveal_for_hash("#First_Section");
43 - applyCss();
44 - strictEqual($("#content_1").is(":visible"), true, "check content is visible on a toggle");
45 - strictEqual($("#anchor_1").is(":visible"), true, "check anchor is visible on toggle");
46 - strictEqual($("#section_1 .hide").is(":visible"), true, "check hide button now visible");
47 - strictEqual($("#section_1 .show").is(":visible"), false, "check show button now hidden");
 44+ strictEqual($("#section_1").hasClass("openSection"), true, "check section is still open");
4845 });
4946
5047 test("wm_reveal_for_hash", function() {
Index: trunk/extensions/MobileFrontend/javascripts/toggle.js
@@ -62,7 +62,7 @@
6363 !u(p).hasClass( 'section_heading' ) ) {
6464 p = p.parentNode;
6565 }
66 - if ( p && p.style.display !== 'block' ) {
 66+ if ( p && ! u( p ).hasClass( 'openSection' ) ) {
6767 section_idx = parseInt( p.id.split( '_' )[1], 10 );
6868 wm_toggle_section( section_idx );
6969 }

Status & tagging log