Skip to content

Commit

Permalink
Make heading subtitle optional
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenbarker authored and jamescdavis committed Jul 17, 2018
1 parent e983872 commit 2c9d28a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ember install ember-content-placeholders

* yield `placeholder.heading`
* Boolean `img` (default: false)
* Boolean `subtitle` (default: true)


* yield `placeholder.text`
Expand Down
1 change: 1 addition & 0 deletions addon/components/content-placeholders-heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import layout from '../templates/components/content-placeholders-heading';
export default ContentPlaceholersBase.extend({
className: 'ember-content-placeholders-heading',
classNameBindings: ['className'],
subtitle: true,
layout
});
4 changes: 3 additions & 1 deletion addon/templates/components/content-placeholders-heading.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
{{/if}}
<div class="{{className}}__content">
<div class="{{className}}__title"></div>
<div class="{{className}}__subtitle"></div>
{{#if subtitle}}
<div class="{{className}}__subtitle"></div>
{{/if}}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ test('it renders', function(assert) {

this.render(hbs`{{content-placeholders-heading img=true}}`);
assert.equal(this.$('[data-test-ember-content-placeholders-heading-img]').length, 1, 'it has an img');

this.render(hbs`{{content-placeholders-heading subtitle=false}}`);
assert.equal(this.$('.ember-content-placeholders-heading__subtitle').length, 0, 'it has no subtitle');

this.render(hbs`{{content-placeholders-heading}}`);
assert.equal(this.$('.ember-content-placeholders-heading__subtitle').length, 1, 'it has a subtitle');
});

0 comments on commit 2c9d28a

Please sign in to comment.