diff --git a/app/assets/styles.css b/app/assets/styles.css index 568ad17c..53758712 100644 --- a/app/assets/styles.css +++ b/app/assets/styles.css @@ -27,6 +27,14 @@ html { vertical-align: middle; } +.deprecated-warning { + padding: var(--spacing-2); + border-radius: var(--radius-lg); + border: 1px solid var(--color-gray-800); + margin-bottom: var(--spacing-2); + line-break: anywhere; +} + main a.edit-icon { height: 1rem; width: 16px; diff --git a/app/components/class-field-description.gjs b/app/components/class-field-description.gjs index 436d298f..bc31b607 100644 --- a/app/components/class-field-description.gjs +++ b/app/components/class-field-description.gjs @@ -142,6 +142,19 @@ export default class ClassFieldDescription extends Component { {{/if}} + + {{#if @field.deprecated}} +
+ No submodules, classes, namespaces, or functions are visible. Some may + be hidden because private and deprecated packages are not shown. + Toggle "Show Private / Deprecated packages" in the sidebar to reveal + them. +
+ {{/if}} + {{/if}} {{outlet}} diff --git a/tests/acceptance/module-test.js b/tests/acceptance/module-test.js index b2471afc..c605eacf 100644 --- a/tests/acceptance/module-test.js +++ b/tests/acceptance/module-test.js @@ -46,6 +46,58 @@ module('Acceptance | Module', function (hooks) { assert.equal(findAll('.spec-method-list li').length, numberSubModules); }); + test('does not show the empty-module warning when the module has submodules', async function (assert) { + await visit('ember/1.0/modules/ember'); + + assert + .dom('[data-test-empty-module-warning]') + .doesNotExist('no warning when module has submodules'); + }); + + test('does not show the empty-module warning when the module has public classes or namespaces', async function (assert) { + await visit('ember/1.0/modules/ember-handlebars'); + + assert + .dom('[data-test-empty-module-warning]') + .doesNotExist('no warning when module has public classes'); + }); + + test('does not show the empty-module warning when the module has public functions', async function (assert) { + // ember/2.16/modules/jquery has only public static functions ($) and no classes, namespaces, or submodules + await visit('ember/2.16/modules/jquery'); + + assert + .dom('[data-test-empty-module-warning]') + .doesNotExist('no warning when module has public functions'); + }); + + test('does not show the empty-module warning on the ember-data-overview page', async function (assert) { + // ember-data-overview has no content at all, but is excluded from the warning by name + await visit('ember-data/4.7/modules/ember-data-overview'); + + assert + .dom('[data-test-empty-module-warning]') + .doesNotExist( + 'no warning on ember-data-overview regardless of empty content', + ); + }); + + test('shows a note when all content is hidden by the private/deprecated filter', async function (assert) { + // ember-htmlbars in 1.13 has only a private class (HandlebarsCompatibleHelper) + // and no public classes, namespaces, submodules, or functions + await visit('ember/1.13/modules/ember-htmlbars'); + + assert + .dom('[data-test-empty-module-warning]') + .exists('warning shown when no public content is visible'); + + await click('[data-test-private-deprecated-toggle]'); + + assert + .dom('[data-test-empty-module-warning]') + .doesNotExist('warning hidden after showing private/deprecated content'); + }); + test('display submodule parent', async function (assert) { await visit('ember/1.0/modules/ember-application');