Skip to content

Instantly share code, notes, and snippets.

@tbrd
Last active August 29, 2015 13:56
Show Gist options
  • Save tbrd/9309685 to your computer and use it in GitHub Desktop.
Save tbrd/9309685 to your computer and use it in GitHub Desktop.
Hashtags component spec
'use strict';
describeComponent('component/hashtags', function () {
// Initialize the component and attach it to the DOM
beforeEach(function () {
setupComponent();
});
it('should be defined', function () {
expect(this.component).toBeDefined();
});
iit('should listen for hashtags data and render hashtags table', function () {
var expectedHTML = '<ul><li>Example, 14</li><li>Example 2, 12</li><li>Example 3, 5</li></ul>';
var template = '<ul>{{#hashtags}}<li>{{text}}, {{frequency}}</li>{{/hashtags}}</ul>';
setupComponent({
template: template
});
$(document).trigger('data-hashtags', {
hashtags: [
{
text: 'Example',
frequency: 14
},
{
text: 'Example 2',
frequency: 12
},
{
text: 'Example 3',
frequency: 5
}
]
});
expect(this.$node.html()).toEqual(expectedHTML);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment