From b477d7389bba6d53f18f9ea3defd445013f24df3 Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Wed, 20 Apr 2011 14:37:39 +0000 Subject: [scaladoc] kindFilter should switch show/hide a... [scaladoc] kindFilter should switch show/hide anchor of package. Closes #4463. Review by malayeri. --- .../scala/tools/nsc/doc/html/resource/lib/index.js | 7 +++-- test/scaladoc/javascript/package.html | 1 + test/scaladoc/javascript/test-index.html | 35 ++++++++++++++++++++++ test/scaladoc/javascript/test-index.js | 17 +++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 test/scaladoc/javascript/package.html create mode 100644 test/scaladoc/javascript/test-index.html create mode 100644 test/scaladoc/javascript/test-index.js diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js index 0f25f024f4..925f07bcb1 100644 --- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js +++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js @@ -438,10 +438,13 @@ function kindFilter(kind) { /* Applies the kind filter. */ function kindFilterSync() { - if (kindFilterState == "all" || focusFilterState != null) + if (kindFilterState == "all" || focusFilterState != null) { + $("#tpl a.packhide").text('hide'); $("#tpl ol.templates").show(); - else + } else { + $("#tpl a.packhide").text('show'); $("#tpl ol.templates").hide(); + } } function resizeFilterBlock() { diff --git a/test/scaladoc/javascript/package.html b/test/scaladoc/javascript/package.html new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/test/scaladoc/javascript/package.html @@ -0,0 +1 @@ +dummy diff --git a/test/scaladoc/javascript/test-index.html b/test/scaladoc/javascript/test-index.html new file mode 100644 index 0000000000..42cbc8cc09 --- /dev/null +++ b/test/scaladoc/javascript/test-index.html @@ -0,0 +1,35 @@ + + + + + + + + + + +

QUnit example

+

+
+

+
    +
    +
    +
    +
    +
      +
    1. template
    2. +
    +
    +
    +
    +
    + +
    + + + diff --git a/test/scaladoc/javascript/test-index.js b/test/scaladoc/javascript/test-index.js new file mode 100644 index 0000000000..121366c931 --- /dev/null +++ b/test/scaladoc/javascript/test-index.js @@ -0,0 +1,17 @@ +Index.PACKAGES = { pkg1: [ { 'class': 'pkg1/Foo.html', name: 'pkg1.Foo' } ] }; + +asyncTest('Trac #4463 - kindFilter', function () { + setTimeout(function () { + start(); + + equal($('#tpl ol.templates:visible').size(), 1); + + kindFilter('packs'); + equal($('#tpl ol.templates:visible').size(), 0); + equal($('#tpl li.pack a.packhide').text(), 'show'); + + kindFilter('all'); + equal($('#tpl ol.templates:visible').size(), 1); + equal($('#tpl li.pack a.packhide').text(), 'hide'); + }, 1000); +}); -- cgit v1.2.3