Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/styles/components/_class-field-desc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ h3 .access{
dd {
display: inline-block;
}
dl.parameters {
margin-left: 24px;
margin-block-start: 0;
}
}

.method, .property, .event {
Expand Down
11 changes: 11 additions & 0 deletions app/templates/components/class-field-description.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
<dt>{{param.name}}</dt>
<dd class="parameter-type">{{param.type}}</dd>
<dd>{{param.description}}</dd>
{{#if param.props}}
<dl class="parameters">
{{#each param.props as |prop|}}
<div class="prop">
<dt>{{prop.name}}</dt>
<dd class="parameter-type">{{prop.type}}</dd>
<dd>{{prop.description}}</dd>
</div>
{{/each}}
</dl>
{{/if}}
</div>
{{/each}}
{{#if this.field.return}}
Expand Down
31 changes: 30 additions & 1 deletion tests/integration/components/class-field-description-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
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) {
Expand Down Expand Up @@ -74,4 +80,27 @@ 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');
});
});