Permalink
Browse files

Add a model to the route and create the component to iterate on

Also display two instances in the application
  • Loading branch information...
corrspt committed Nov 19, 2016
1 parent b558090 commit aa38977b5d6df16d9d286d3baedc097f02d308d9
@@ -0,0 +1,4 @@
import Ember from 'ember';
export default Ember.Component.extend({
});
@@ -1,4 +1,7 @@
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.createRecord('person');
}
});
@@ -1 +1,28 @@
{{outlet}}
<div class="container">
<h2 id="title">Conventions, Conventions</h2>
<div class="row">
<div class="col-sm-6">
{{
attribute-text
model=model
attribute='name'
label='Name'
placeholder='Insert your name'
}}
</div>
<div class="col-sm-6">
{{
attribute-text
model=model
attribute='age'
label='Age'
placeholder='Insert your age'
}}
</div>
</div>
{{outlet}}
</div>
@@ -0,0 +1,13 @@
<div class="form-group">
<label title="{{placeholder}}" class='control-label' for='{{attribute}}'>
{{label}}
</label>
<input
value={{get model attribute}}
class='form-control'
placeholder={{placeholder}}
type='text'
id={{attribute}}
>
</div>
@@ -0,0 +1,24 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('attribute-text', 'Integration | Component | attribute text', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{attribute-text}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#attribute-text}}
template block text
{{/attribute-text}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});

0 comments on commit aa38977

Please sign in to comment.