feat: 🎸 add initial color theme toggle UX

This commit is contained in:
Randall Morey committed 2020-11-04 13:51:37 -05:00
1 parent 5c1f79f98d
commit ef96369392
9 files changed
+98 -4

No files matched your search

@@ -1,3 +1,3 @@
{{yield (hash
radio=(component 'rose/form/radio/radio' name=@name selectedValue=@selectedValue disabled=@disabled)
radio=(component 'rose/form/radio/radio' name=@name selectedValue=@selectedValue disabled=@disabled changed=@changed)
)}}
@@ -1,5 +1,6 @@
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
import { hbs } from 'ember-cli-htmlbars';
import { action } from '@storybook/addon-actions';
import { text, boolean } from '@storybook/addon-knobs';
<Meta title="Rose|Form/Radio/Group" component="Form/Radio/Group" />
@@ -13,6 +14,7 @@ Renders a form radiofield group.
@disabled={{false}}
@name={{name}}
@selectedValue="disagree"
@changed={{fn}}
as |radioGroup|
>
<radioGroup.radio
@@ -36,6 +38,7 @@ Renders a form radiofield group.
@disabled={{disabled}}
@name={{name}}
@selectedValue={{selectedValue}}
@changed={{changed}}
as |radioGroup|
>
<radioGroup.radio
@@ -62,6 +65,7 @@ Renders a form radiofield group.
secondFieldValue: text('second value', 'maybe'),
thirdFieldLabel: text('third label', 'Disagree'),
thirdFieldValue: text('third value', 'disagree'),
changed: action('changed')
}
}}</Story>
</Preview>
@@ -9,7 +9,8 @@
@name={{@name}}
@value={{@value}}
@groupValue={{@selectedValue}}
@disabled={{@disabled}}/>
@disabled={{@disabled}}
@changed={{@changed}} />
<label class="rose-form-radio-label" for={{this.id}}>
{{@label}}
@@ -15,6 +15,7 @@ Renders a form radiofield.
@value="yes-agree"
@selectedValue="yes-agree"
@disabled={{false}}
@changed={{fn}}
/>
```
@@ -52,9 +52,15 @@ module('Integration | Component | rose/form/radio/group', function (hooks) {
assert.equal(findAll('[type="radio"]')[1].checked, false);
});
test('it reflects active radiofield value in @selectedValue', async function (assert) {
test('it reflects active radiofield value in @selectedValue and triggers a @changed function', async function (assert) {
assert.expect(5);
this.changed = (value) => assert.ok(value);
await render(hbs`
<Rose::Form::Radio::Group @name="bird" @selectedValue={{this.selectedValue}} as |radioGroup|>
<Rose::Form::Radio::Group
@name="bird"
@selectedValue={{this.selectedValue}}
@changed={{this.changed}}
as |radioGroup|>
<radioGroup.radio
@name="bird"
@label="Pegion"