Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra params for selectedItemComponent on trigger (power-select-multiple) #1075

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
aa9ba06
Fix: add extra hash to power-select-multiple selectedItemComponent
alexdiliberto Mar 11, 2018
bfffc23
Test: Add a couple missing tests for power-select-multiple with custo…
alexdiliberto Mar 11, 2018
18f1ef1
Update how-to-use-it.hbs (#1080)
Mar 28, 2018
72a8633
Update installation.hbs (#1078)
Mar 28, 2018
52538cd
Update installation.hbs (#1079)
Mar 28, 2018
96448de
Update action-handling.hbs (#1081)
Mar 28, 2018
5d22c63
stop click propagation added to the docs (#1087)
0000marcell Apr 11, 2018
51e4411
Update addon to 3.1 (#1088)
cibernox Apr 15, 2018
26ccb12
Modernize test suite part 1 (#1089)
cibernox Apr 15, 2018
0327ffc
Modernize test suite part 2 (#1090)
cibernox Apr 15, 2018
14b5b67
Modernize test suite part 3 (#1091)
cibernox Apr 16, 2018
c301ba8
Modernize test suite part 4 (#1092)
cibernox Apr 16, 2018
9ec9cf6
Modernize test suite part 5 (#1093)
cibernox Apr 16, 2018
0a224ee
Remove more usages of ember-native-dom-helpers
cibernox Apr 17, 2018
97621af
Add more qunit-dom
cibernox Apr 17, 2018
d9e0d4c
fixes #1094 (#1097)
donaldwasserman Apr 19, 2018
3d94c68
qunit-dom is almost everywhere (#1096)
cibernox Apr 19, 2018
f2364a8
v2.0.0-beta.4
cibernox Apr 19, 2018
6cb7f5a
Simplify tests a bit more
cibernox Apr 20, 2018
06cbfa7
Penultimate test refactor (#1098)
cibernox Apr 22, 2018
d696c28
Remove all traces of find/findAll from ember-native-dom-helpers
cibernox Apr 22, 2018
44c8452
Changed self.window to window and self.document to document (#1099)
Apr 24, 2018
601579c
v2.0.0-beta.5
cibernox Apr 24, 2018
2087909
Pre-render docs site at build time (#1102)
ef4 Apr 25, 2018
bd5bd5d
Making helpers more async (#1100)
cibernox Apr 27, 2018
8a0583e
Improve component's behavior in beta (#1104)
cibernox Apr 27, 2018
820a0d4
Fix typo
cibernox Apr 27, 2018
0b18f7a
Remove native dom helpers (#1105)
pablobm Apr 29, 2018
69dd655
Update changelog
cibernox Apr 29, 2018
dbd8548
v2.0.0
cibernox Apr 30, 2018
dc46c33
Update ember-concurrency to fix bug in beta and canary (#1106)
cibernox May 2, 2018
5e7b02d
Drop node 4
cibernox May 9, 2018
5b56ec6
Fix: add extra hash to power-select-multiple selectedItemComponent
alexdiliberto Mar 11, 2018
25e3a3a
Test: Add a couple missing tests for power-select-multiple with custo…
alexdiliberto Mar 11, 2018
b607238
Merge branch 'patch-1' of github.com:alexdiliberto/ember-power-select…
alexdiliberto May 9, 2018
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: 2 additions & 2 deletions addon/templates/components/power-select-multiple/trigger.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</span>
{{/unless}}
{{#if selectedItemComponent}}
{{component selectedItemComponent option=(readonly opt) select=(readonly select)}}
{{component selectedItemComponent extra=(readonly extra) option=(readonly opt) select=(readonly select)}}
{{else}}
{{yield opt select}}
{{/if}}
Expand All @@ -36,4 +36,4 @@
onkeydown={{action "onKeydown"}}>
{{/if}}
</ul>
<span class="ember-power-select-status-icon"></span>
<span class="ember-power-select-status-icon"></span>
4 changes: 2 additions & 2 deletions tests/dummy/app/templates/components/selected-country.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<img src="{{select.selected.flagUrl}}" class="icon-flag" alt="Flag of {{select.selected.name}}">
{{select.selected.name}}
<img src="{{select.selected.flagUrl}}" class="icon-flag {{if extra.coolFlagIcon 'cool-flag-icon'}}" alt="Flag of {{select.selected.name}}">
{{select.selected.name}}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<img src="{{select.selected.flagUrl}}" class="icon-flag" alt="Flag of {{select.selected.name}}">
{{select.selected.name}}
<img src="{{select.selected.flagUrl}}" class="icon-flag {{if extra.coolFlagIcon 'cool-flag-icon'}}" alt="Flag of {{select.selected.name}}">
{{select.selected.name}}
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,60 @@ module('Integration | Component | Ember Power Select (Customization using compon

clickTrigger();
});

test('the power-select-multiple `optionsComponent` receives the `extra` hash', async function(assert) {
assert.expect(2);

this.countries = countries;
this.country = countries[1]; // Spain

await render(hbs`
{{#power-select-multiple options=countries selected=country optionsComponent="list-of-countries" onchange=(action (mut foo)) extra=(hash field='code') as |country|}}
{{country.code}}
{{/power-select-multiple}}
`);

clickTrigger();
let text = find('.ember-power-select-options').textContent.trim();
assert.ok(/Countries:/.test(text), 'The given component is rendered');
assert.ok(/3\. RU/.test(text), 'The component uses the field in the extra has to render the options');
});

test('the power-select-multiple `triggerComponent` receives the `extra` hash', async function(assert) {
assert.expect(1);

this.countries = countries;
this.country = countries[1]; // Spain

await render(hbs`
{{#power-select-multiple options=countries selected=country triggerComponent="selected-country" onchange=(action (mut foo)) extra=(hash coolFlagIcon=true) as |country|}}
{{country.code}}
{{/power-select-multiple}}
`);

clickTrigger();
assert.ok(find('.ember-power-select-trigger .cool-flag-icon'), 'The custom triggerComponent renders with the extra.coolFlagIcon customization option triggering some state change.');
});

test('the power-select-multiple `selectedItemComponent` receives the `extra` hash', async function(assert) {
assert.expect(1);

this.countries = countries;
this.country = [countries[1]]; // Spain

await render(hbs`
<div class="select-box">
{{#power-select-multiple
options=countries
selected=country
selectedItemComponent="selected-item-country"
onchange=(action (mut selected))
extra=(hash coolFlagIcon=true) as |country|}}
{{country.code}}
{{/power-select-multiple}}
</div>
`);

assert.ok(find('.ember-power-select-trigger .cool-flag-icon'), 'The custom selectedItemComponent renders with the extra.coolFlagIcon customization option triggering some state change.');
});
});