February 2016
Beginner to intermediate
308 pages
5h 46m
English
Components should be tested using integration tests. In this recipe, we'll look at a simple example of a component that changes the size of the text.
font-sizer:
$ ember g component font-sizer
This will generate a new component called font-sizer. This component will be used to resize text.
font-sizer.js file in the components folder:// app/components/font-sizer.js
import Ember from 'ember';
export default Ember.Component.extend({
textInfo: 'Hello World',
attributeBindings: ['style'],
style: Ember.computed('size',function() {
const size = this.get('size');
return new Ember.Handlebars.SafeString("font-size: "+ size);
})
});All components render as div ...
Read now
Unlock full access