From 7c4d335613876a1eba34e16d4151c0efa2395258 Mon Sep 17 00:00:00 2001 From: Simon Dahlbacka Date: Wed, 27 Oct 2021 15:51:27 +0300 Subject: [PATCH 1/3] add a test --- .../class-field-description-test.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/integration/components/class-field-description-test.js b/tests/integration/components/class-field-description-test.js index 8c0bb93e..ea7ed10b 100644 --- a/tests/integration/components/class-field-description-test.js +++ b/tests/integration/components/class-field-description-test.js @@ -1,7 +1,7 @@ import EmberObject from '@ember/object'; import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; -import { render, click, findAll, triggerEvent } from '@ember/test-helpers'; +import { render, click, findAll, find, triggerEvent } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; module('Integration | Component | class field description', function (hooks) { @@ -74,4 +74,23 @@ module('Integration | Component | class field description', function (hooks) { assert.verifySteps(['updateAnchorAction']); }); + + test('parameter props are displayed', async function (assert) { + this.set('type', 'method'); + this.set( + 'field', + EmberObject.create({ + access: 'public', + deprecated: true, + name: 'concat', + description: 'concatenates', + params: [{ name: 'param1' }, { name: 'param2' }, { name: 'options', props: [ { name: 'prop1' }, { name: 'prop2' }] }], + }) + ); + + await render(hbs`{{class-field-description type=type field=field}}`); + + assert.dom(find('.prop:nth-child(1) dt')).hasText('prop1'); + assert.dom(find('.prop:nth-child(2) dt')).hasText('prop2'); + }); }); From 313d0c49f380e19c6372304fecbb400c0d1263a5 Mon Sep 17 00:00:00 2001 From: Simon Dahlbacka Date: Wed, 27 Oct 2021 15:52:24 +0300 Subject: [PATCH 2/3] display props if we have some --- app/styles/components/_class-field-desc.scss | 4 ++++ app/templates/components/class-field-description.hbs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/styles/components/_class-field-desc.scss b/app/styles/components/_class-field-desc.scss index 9bbe0a2a..f48da7da 100644 --- a/app/styles/components/_class-field-desc.scss +++ b/app/styles/components/_class-field-desc.scss @@ -50,6 +50,10 @@ h3 .access{ dd { display: inline-block; } + dl.parameters { + margin-left: 24px; + margin-block-start: 0; + } } .method, .property, .event { diff --git a/app/templates/components/class-field-description.hbs b/app/templates/components/class-field-description.hbs index f1e25788..8204c607 100644 --- a/app/templates/components/class-field-description.hbs +++ b/app/templates/components/class-field-description.hbs @@ -55,6 +55,17 @@
{{param.name}}
{{param.type}}
{{param.description}}
+ {{#if param.props}} +
+ {{#each param.props as |prop|}} +
+
{{prop.name}}
+
{{prop.type}}
+
{{prop.description}}
+
+ {{/each}} +
+ {{/if}} {{/each}} {{#if this.field.return}} From f3854a08b2b20b2cf13223af3823dc4b6e88eb7e Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Tue, 9 Nov 2021 03:11:32 +0000 Subject: [PATCH 3/3] fix lint --- .../components/class-field-description-test.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/integration/components/class-field-description-test.js b/tests/integration/components/class-field-description-test.js index ea7ed10b..dd8a0249 100644 --- a/tests/integration/components/class-field-description-test.js +++ b/tests/integration/components/class-field-description-test.js @@ -1,7 +1,13 @@ import EmberObject from '@ember/object'; import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; -import { render, click, findAll, find, triggerEvent } from '@ember/test-helpers'; +import { + render, + click, + findAll, + find, + triggerEvent, +} from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; module('Integration | Component | class field description', function (hooks) { @@ -84,7 +90,11 @@ module('Integration | Component | class field description', function (hooks) { deprecated: true, name: 'concat', description: 'concatenates', - params: [{ name: 'param1' }, { name: 'param2' }, { name: 'options', props: [ { name: 'prop1' }, { name: 'prop2' }] }], + params: [ + { name: 'param1' }, + { name: 'param2' }, + { name: 'options', props: [{ name: 'prop1' }, { name: 'prop2' }] }, + ], }) );