Skip to content

Commit

Permalink
Bind title to the trigger (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox authored Jun 21, 2018
1 parent c2f3bc1 commit 7ffe3f0
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 510 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Master

- [FEATURE] You can add a title to the trigger by passing `title="The title"` to `{{power-select}}` or `{{power-select-multiple}}`

# 2.0.3
- [BUGFIX] Remove forgoten console statement in test helper

Expand Down
2 changes: 2 additions & 0 deletions addon/templates/components/power-select-multiple.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
selectedItemComponent=selectedItemComponent
tabindex=computedTabIndex
tagName=tagName
title=title
triggerClass=concatenatedTriggerClass
triggerComponent=(component triggerComponent tabindex=tabindex)
triggerId=triggerId
Expand Down Expand Up @@ -109,6 +110,7 @@
selectedItemComponent=selectedItemComponent
tabindex=computedTabIndex
tagName=tagName
title=title
triggerClass=concatenatedTriggerClass
triggerComponent=(component triggerComponent tabindex=tabindex)
triggerId=triggerId
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/power-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ariaLabel=(readonly ariaLabel)
ariaLabelledBy=(readonly ariaLabelledBy)
ariaRequired=(readonly required)
title=(readonly title)
class=(readonly concatenatedTriggerClasses)
extra=(readonly extra)
id=(readonly triggerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,4 +1205,17 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
assert.dom('.ember-power-select-option').exists({ count: 1 });
assert.dom('.ember-power-select-option').hasClass('ember-power-select-option--loading-message');
});

test('The title is rendered in the trigger', async function (assert) {
assert.expect(1);

this.numbers = numbers;
await render(hbs`
{{#power-select options=numbers onchange=(action (mut foo)) title="The title" as |option|}}
{{option}}
{{/power-select}}
`);

assert.dom('.ember-power-select-trigger').hasAttribute('title', 'The title');
});
});
13 changes: 13 additions & 0 deletions tests/integration/components/power-select/multiple-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,4 +825,17 @@ module('Integration | Component | Ember Power Select (Multiple)', function(hooks
`);
assert.dom('.ember-power-select-multiple-options .ember-power-select-multiple-option--disabled').exists({ count: disabledNumCountries }, 'The class "ember-power-select-multiple-option--disabled" is added to disabled options');
});

test('The title is rendered in the trigger of multiple selects', async function (assert) {
assert.expect(1);

this.numbers = numbers;
await render(hbs`
{{#power-select-multiple options=numbers onchange=(action (mut foo)) title="The title" as |option|}}
{{option}}
{{/power-select-multiple}}
`);

assert.dom('.ember-power-select-trigger').hasAttribute('title', 'The title');
});
});
Loading

0 comments on commit 7ffe3f0

Please sign in to comment.