Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Allow independent setting of font awesome weight #70

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion addon/components/adde-tooltip-icon.js
Expand Up @@ -25,7 +25,7 @@ import layout from '../templates/components/adde-tooltip-icon';
* ```
*/
@tagName('i')
@classNames('fas', 'tooltip-icon')
@classNames('tooltip-icon')
export default class AddeTooltipIcon extends Component {
layout = layout;

Expand Down Expand Up @@ -59,4 +59,20 @@ export default class AddeTooltipIcon extends Component {
@argument
@type('string')
tooltipClass = '';

/**
* An optional weight defaults to strong with a class of "fas"
*
* Valid options include:
* fa
* fas
* far
* fal
* fad
* fab
*/
@argument
@type('string')
@className
iconWeightClass = 'fas';
}
29 changes: 29 additions & 0 deletions tests/integration/components/adde-tooltip-icon-test.js
Expand Up @@ -112,3 +112,32 @@ test('tooltip box direction can be modified', async function(assert) {
'tooltip box reflects correct direction'
);
});

test('tooltip can set iconWeight', async function(assert) {
assert.expect(2);

this.render(hbs`
{{#adde-tooltip-icon data-test-tooltip-icon=true iconWeight="far"}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{#adde-tooltip-icon data-test-tooltip-icon=true iconWeight="far"}}
{{#adde-tooltip-icon data-test-tooltip-icon=true iconWeightClass="far"}}

? I think the argument is iconWeightClass?

template block text
{{/adde-tooltip-icon}}
`);

let icon = new IconHelper();

assert.ok(icon.isIcon('far'), 'tooltip icon has new class');
assert.ok(!icon.isIcon('fas'), 'tooltip icon no longer has default class');
});

test('tooltip can set iconWeight defaults to fas', async function(assert) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to ensure that we kept existant behavior. When no iconWeight is specified the class is set to fas

assert.expect(1);

this.render(hbs`
{{#adde-tooltip-icon data-test-tooltip-icon=true}}
template block text
{{/adde-tooltip-icon}}
`);

let icon = new IconHelper();

assert.ok(icon.isIcon('fas'), 'tooltip icon has new class');
});