forked from acoustep/ember-cli-foundation-6-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request acoustep#62 from donaldwasserman/feat/flash
Add Callout/Flash Message component
- Loading branch information
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Ember from 'ember'; | ||
import layout from '../templates/components/zf-callout'; | ||
import zfWidget from 'ember-cli-foundation-6-sass/mixins/zf-widget'; | ||
|
||
const {computed} = Ember; | ||
|
||
export default Ember.Component.extend(zfWidget, { | ||
layout: layout, | ||
type: '', | ||
content: null, | ||
classNameBindings: ['alertType', 'active', 'exiting', 'flashType'], | ||
classNames: ['callout'], | ||
|
||
// handle bindings for ember-cli-flash integration | ||
flashType: computed('flash.type', function() { | ||
return this.get('flash.type'); | ||
}), | ||
|
||
// handle bindings for regular integration | ||
alertType: computed('type', function() { | ||
return this.get('type'); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{#if hasBlock}} | ||
{{#if flash}} | ||
{{!-- todo: investigate using block-slots --}} | ||
{{yield this flash}} | ||
{{/if}} | ||
{{!-- this contains user provided block content --}} | ||
{{yield}} | ||
|
||
{{else}} | ||
|
||
{{#if flash}} | ||
{{flash.message}} | ||
|
||
{{/if}} | ||
|
||
{{#if content}} | ||
{{content}} | ||
{{/if}} | ||
|
||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-cli-foundation-6-sass/components/zf-callout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
moduleForComponent('zf-callout', 'Integration | Component | zf callout', { | ||
integration: true | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
|
||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + | ||
|
||
this.render(hbs`{{zf-callout}}`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage:" + EOL + | ||
this.render(hbs` | ||
{{#zf-callout}} | ||
template block text | ||
{{/zf-callout}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
}); |