+
{{inline-svg @name}}
diff --git a/addons/rose/stories/button.stories.js b/addons/rose/stories/button.stories.js
index 645f8c39c..53cca2788 100644
--- a/addons/rose/stories/button.stories.js
+++ b/addons/rose/stories/button.stories.js
@@ -6,19 +6,29 @@ export default {
title: 'Rose::Button',
};
+const icons = {
+ none: null,
+ 'alert-circle-fill': 'alert-circle-fill',
+ 'chevron-right': 'chevron-right',
+ 'copy-action': 'copy-action',
+ 'lock-closed': 'lock-closed',
+};
+
export const Normal = () => ({
template: hbs`
{{text}}
`,
context: {
- text: text('text', 'Button 🌈'),
+ text: text('text', 'Button'),
submit: boolean('submit', false),
disabled: boolean('disabled', false),
style: select(
@@ -32,6 +42,27 @@ export const Normal = () => ({
},
'primary'
),
+ iconLeft: select('iconLeft', icons, 'copy-action'),
+ iconRight: select('iconRight', icons, 'chevron-right'),
onClick: action('clicked'),
},
});
+
+export const IconOnly = () => ({
+ template: hbs`
+ Icon-only buttons visually hide their text, revealing just an icon.
+ It's still important to include meaningful text in the body of the
+ button for accessibility purposes.
+
+
+ {{text}}
+
+ `,
+ context: {
+ text: text('text', 'Button'),
+ iconOnly: select('iconOnly', icons, 'lock-closed'),
+ },
+});
diff --git a/addons/rose/tests/integration/components/rose/button-test.js b/addons/rose/tests/integration/components/rose/button-test.js
index 89ba514fb..be532a65f 100644
--- a/addons/rose/tests/integration/components/rose/button-test.js
+++ b/addons/rose/tests/integration/components/rose/button-test.js
@@ -13,23 +13,35 @@ module('Integration | Component | rose/button', function (hooks) {
test('it is type="button" by default', async function (assert) {
await render(hbs`Button`);
- assert.equal(await find('button').type, 'button');
+ assert.equal(find('button').type, 'button');
});
test('it is type="submit" when @submit={{true}}', async function (assert) {
await render(hbs``);
- assert.equal(await find('button').type, 'submit');
+ assert.equal(find('button').type, 'submit');
});
test('it is disabled when @disabled={{true}}', async function (assert) {
await render(hbs``);
- assert.equal(await find('button').disabled, true);
+ assert.equal(find('button').disabled, true);
});
test('it adds a style class', async function (assert) {
await render(hbs``);
- assert.ok(await find('button.rose-button-primary'));
+ assert.ok(find('.rose-button-primary'));
await render(hbs``);
- assert.ok(await find('button.rose-button-secondary'));
+ assert.ok(find('.rose-button-secondary'));
+ });
+
+ test('it supports left and right icons', async function (assert) {
+ await render(hbs``);
+ assert.ok(find('.has-icon-left .rose-icon'));
+ await render(hbs``);
+ assert.ok(find('.has-icon-right .rose-icon'));
+ });
+
+ test('it supports an icon-only type', async function (assert) {
+ await render(hbs``);
+ assert.ok(find('.has-icon-only .rose-icon'));
});
});