Skip to content

Commit

Permalink
feat(toast-message): Addon test support (#110)
Browse files Browse the repository at this point in the history
* feat(toast-message): added addon-test-support

* fix(toast-message): removed title margin

* fix: removed wormhole usage

* feat: initialize helper

* Approved Toast

Co-authored-by: Sharath Sriram <[email protected]>
  • Loading branch information
shibulijack-fd and sharath-sriram authored Feb 10, 2020
1 parent 79ed2f5 commit 5bbb30a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 47 deletions.
3 changes: 3 additions & 0 deletions packages/toast-message/addon-test-support/initialize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({ init() {} });
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
padding-right: 16px;
flex-grow: 2;

.title {
margin: 0;
}

.link {
color: $text-info;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
{{#ember-wormhole to="nucleus-toast-messages-wormhole"}}
<div class="nucleus-toast-messages {{position}}">
{{#each flashMessages.queue as |flash|}}
{{#transition-group transitionClass="slide-down"}}
{{#flash-message flash=flash class="nucleus-toast-message" as |component flash close|}}
<div class="nucleus-toast-message__icon">{{nucleus-icon name=(get _iconMap component.flashType) size="medium"}}</div>
<div class="nucleus-toast-message__content">
<p>{{flash.message}}</p>
{{#if flash.content}}
<a role="button"
class="link"
aria-label={{flash.content.linkText}}
onClick={{action flash.content.linkAction}}>
{{flash.content.linkText}}
</a>
{{/if}}
</div>
<div class="nucleus-toast-message__close">
{{nucleus-button
variant="text"
size="mini"
customClass=(concat "flash-message-close")
icon="nucleus-cross"
onClick=(action close)}}
</div>
{{/flash-message}}
{{/transition-group}}
{{/each}}
</div>
{{/ember-wormhole}}
<div class="nucleus-toast-messages {{position}}">
{{#each flashMessages.queue as |flash|}}
{{#transition-group transitionClass="slide-down"}}
{{#flash-message flash=flash class="nucleus-toast-message" as |component flash close|}}
<div class="nucleus-toast-message__icon">{{nucleus-icon name=(get _iconMap component.flashType) size="medium"}}</div>
<div class="nucleus-toast-message__content">
<p class="title">{{flash.message}}</p>
{{#if flash.content}}
<a role="button"
class="link"
aria-label={{flash.content.linkText}}
onClick={{action flash.content.linkAction}}>
{{flash.content.linkText}}
</a>
{{/if}}
</div>
<div class="nucleus-toast-message__close">
{{nucleus-button
variant="text"
size="mini"
customClass=(concat "flash-message-close")
icon="nucleus-cross"
onClick=(action close)}}
</div>
{{/flash-message}}
{{/transition-group}}
{{/each}}
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions packages/toast-message/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"ember-css-transitions": "^0.1.16",
"ember-decorators": "^6.1.1",
"ember-decorators-polyfill": "shibulijack-fd/ember-decorators-polyfill#master",
"ember-truth-helpers": "^2.1.0",
"ember-wormhole": "^0.5.5"
"ember-truth-helpers": "^2.1.0"
},
"devDependencies": {
"@ember/optional-features": "^1.0.0",
Expand Down
13 changes: 0 additions & 13 deletions packages/toast-message/tests/helpers/setup-toast-message.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import test from 'ember-sinon-qunit/test-support/test';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import FlashMessage from 'ember-cli-flash/flash/object';
import setupToastMessage from '../../helpers/setup-toast-message';
import backstop from 'ember-backstop/test-support/backstop';

module('Integration | Component | nucleus-toast-message', function(hooks) {
setupRenderingTest(hooks);
setupToastMessage(hooks);

hooks.beforeEach(function() {
const typesUsed = ['info', 'warning', 'success', 'danger'];
Expand Down

0 comments on commit 5bbb30a

Please sign in to comment.