Skip to content

Commit

Permalink
Rename component
Browse files Browse the repository at this point in the history
Thanks to @lukemelia for this suggestion on handling component
name overlaps:
emberjs/ember.js#17997 (comment)
  • Loading branch information
backspace committed Jul 8, 2019
1 parent a28e9de commit fe30164
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions ui/app/components/addon-copy-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-clipboard/components/copy-button';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Component from '@ember/component';
import { run } from '@ember/runloop';

export default Component.extend({
classNames: ['x-copy-button'],
classNames: ['copy-button'],

state: null,

Expand Down
2 changes: 1 addition & 1 deletion ui/app/styles/core/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ $button-box-shadow-standard: 0 2px 0 0 rgba($grey, 0.2);
}
}

.x-copy-button {
.copy-button {
padding-left: 0.5rem;
margin-bottom: 2px;

Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/allocations/allocation/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<span class="bumper-left tag {{model.statusClass}}">{{model.clientStatus}}</span>
<span class="tag is-hollow is-small no-text-transform">
{{model.id}}
{{x-copy-button clipboardText=model.id}}
{{copy-button clipboardText=model.id}}
</span>
{{#if model.isRunning}}
{{two-step-button
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/clients/client.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{or model.name model.shortId}}
<span class="tag is-hollow is-small no-text-transform">
{{model.id}}
{{x-copy-button clipboardText=model.id}}
{{copy-button clipboardText=model.id}}
</span>
</h1>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
</span>
</div>
{{else}}
{{#copy-button
{{#addon-copy-button
class='button is-borderless is-small'
clipboardText=clipboardText
success=(action 'success')
error=(action (mut state) 'error')
}}
{{x-icon 'copy-action'}}
{{/copy-button}}
{{/addon-copy-button}}
{{/if}}
8 changes: 4 additions & 4 deletions ui/tests/integration/components/x-copy-button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import sinon from 'sinon';

import { triggerCopyError, triggerCopySuccess } from 'ember-cli-clipboard/test-support';

module('Integration | Component | x-copy-button', function(hooks) {
module('Integration | Component | copy-button', function(hooks) {
setupRenderingTest(hooks);

test('it shows the copy icon by default', async function(assert) {
await render(hbs`{{x-copy-button class='copy-button'}}`);
await render(hbs`{{copy-button class='copy-button'}}`);

assert.dom('.copy-button .icon-is-copy-action').exists();
});

test('it shows the success icon on success and resets afterward', async function(assert) {
const clock = sinon.useFakeTimers();

await render(hbs`{{x-copy-button class='copy-button'}}`);
await render(hbs`{{copy-button class='copy-button'}}`);

await click('.copy-button button');
await triggerCopySuccess('.copy-button button');
Expand All @@ -35,7 +35,7 @@ module('Integration | Component | x-copy-button', function(hooks) {
});

test('it shows the error icon on error', async function(assert) {
await render(hbs`{{x-copy-button class='copy-button'}}`);
await render(hbs`{{copy-button class='copy-button'}}`);

await click('.copy-button button');
await triggerCopyError('.copy-button button');
Expand Down

0 comments on commit fe30164

Please sign in to comment.