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

Changed the usage of paper-radio inside of paper-radio-group #429

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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Contributions and pull requests are always welcome. Contributors may often be fo
- Actions maybe be specified by a string action name (`onChange="updateValue"`) or an action closure (`onChange=(action (mut "myValue"))`). If you need to specify a target or additional parameter, you must use an action closure.
- Many attributes have been renamed for clarity and consistency. See the specific changes below.
- `paper-icon`'s `size` attribute now takes a size in pixels, and `lg` or `sm` values are no longer supported.
- renamed the `paper-radio-group` `paper-radio` to just `radio` -- usage would now be `group.radio` as opposed to `group.paper-radio`.

#### 1.0.0-alpha.2

Expand All @@ -28,7 +29,7 @@ Contributions and pull requests are always welcome. Contributors may often be fo
- `paper-sidenav-toggle` is now tagless. It is essentially a functional component that yields an action to its block
- `paper-sidenav` now can use a `position` param that positions the sidenav `left` (default) or `right`
- `paper-backdrop` action `onTap` changed to `onClick`
- [#408](https://github.com/miguelcobain/ember-paper/pull/408) added paper-form component. `paper-input`'s `onInvalid` action renamed to `onValidityChange`
- [#408](https://github.com/miguelcobain/ember-paper/pull/408) added paper-form component. `paper-input`'s `onInvalid` action renamed to `onValidityChange`

#### 1.0.0-alpha.1

Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/paper-radio-group.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{yield (hash
paper-radio=(component "paper-radio"
radio=(component "paper-radio"
toggle=toggle
disabled=disabled
groupValue=groupValue
Expand Down
24 changes: 12 additions & 12 deletions tests/dummy/app/templates/demo/radio.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
<h2>Radio Button Group</h2>
{{! BEGIN-SNIPPET radio.group }}
{{#paper-radio-group groupValue=groupValue onChange=(action (mut groupValue)) as |group|}}
{{#group.paper-radio value="1" primary=true}}
{{#group.radio value="1" primary=true}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2" warn=true}}
{{/group.radio}}
{{#group.radio value="2" warn=true}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}

<p>Selected value: {{groupValue}}</p>
Expand All @@ -36,15 +36,15 @@
<h3>Radio Button w/ Images</h3>
{{! BEGIN-SNIPPET radio.images }}
{{#paper-radio-group groupValue=groupValue2 onChange=(action (mut groupValue2)) as |group|}}
{{#group.paper-radio value="image1" primary=true}}
{{#group.radio value="image1" primary=true}}
<img src="http://diagramcenter.org/wp-content/uploads/2016/03/image.png">
{{/group.paper-radio}}
{{#group.paper-radio value="image2" warn=true}}
{{/group.radio}}
{{#group.radio value="image2" warn=true}}
<img src="http://www.coffeecup.com/images/software/icons/image-mapper_5.0_win_en.png">
{{/group.paper-radio}}
{{#group.paper-radio value="image3"}}
{{/group.radio}}
{{#group.radio value="image3"}}
<img src="http://a2.mzstatic.com/us/r30/Purple69/v4/d3/3c/13/d33c13c4-2cdd-0ef7-13f3-e3097607f2da/icon128.png">
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
{{! END-SNIPPET }}

Expand Down
76 changes: 38 additions & 38 deletions tests/integration/components/paper-radio-group-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ test('should set and remove checked css class', function(assert) {
this.set('groupValue', '1');
this.render(hbs`
{{#paper-radio-group groupValue=groupValue onChange=(action (mut groupValue)) as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);
assert.ok(this.$('md-radio-button').hasClass('md-checked'));
Expand All @@ -55,15 +55,15 @@ test('should trigger an action when checking', function(assert) {

this.render(hbs`
{{#paper-radio-group groupValue=groupValue onChange=handleChange as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);

Expand All @@ -80,15 +80,15 @@ test('should trigger an action when unchecking (toggle is true)', function(asser

this.render(hbs`
{{#paper-radio-group groupValue=groupValue toggle=true onChange=handleChange as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);

Expand All @@ -104,15 +104,15 @@ test('shouldn\'t trigger an action when disabled', function(assert) {

this.render(hbs`
{{#paper-radio-group groupValue=groupValue disabled=true onChange=(action (mut groupValue)) as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);

Expand All @@ -124,15 +124,15 @@ test('should be possible to select next with down/right arrow in a paper-radio-g

this.render(hbs`
{{#paper-radio-group groupValue=groupValue onChange=(action (mut groupValue)) as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);

Expand All @@ -150,15 +150,15 @@ test('should be possible to select next with up/left arrow in a paper-radio-grou

this.render(hbs`
{{#paper-radio-group groupValue=groupValue onChange=(action (mut groupValue)) as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{#group.paper-radio value="2"}}
{{/group.radio}}
{{#group.radio value="2"}}
Radio button 2
{{/group.paper-radio}}
{{#group.paper-radio value="3"}}
{{/group.radio}}
{{#group.radio value="3"}}
Radio button 3
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);

Expand All @@ -177,9 +177,9 @@ test('the `onChange` action is mandatory for paper-radio-group', function(assert
assert.throws(() => {
this.render(hbs`
{{#paper-radio-group groupValue=groupValue as |group|}}
{{#group.paper-radio value="1"}}
{{#group.radio value="1"}}
Radio button 1
{{/group.paper-radio}}
{{/group.radio}}
{{/paper-radio-group}}
`);
}, /requires an `onChange` action/);
Expand Down