Skip to content

Instantly share code, notes, and snippets.

Handlebars.registerHelper('unbound', function(property, fn) {
return this.get(property);
});
Onetoone.Model1 = SC.Record.extend(
model1Value: SC.Record.attr(String, {}),
model2: SC.Record.toOne('Onetoone.Model2', {inverse:'model1', isMaster: NO})
}) ;
{{#view id="messages" isVisibleBinding="App.noticesListController.isEmpty"}}
{{#collection App.NoticeCollectionView }}
{{content.body}}
<a class="hide">Dismiss</a>
{{/collection}}
{{/view}}
App.NoticeCollectionView = SC.TemplateCollectionView.extend({
contentBinding: 'App.noticesListController',
tagName: 'div',
classNames: ['message', 'notices'],
itemView: SC.TemplateView.extend({
tagName: 'p',
classNames: ['notice']
})
})
@gmoeck
gmoeck / setupApplication.js
Created May 28, 2011 14:20
setupApplication.js
// This file is the setup for integration testing file
// This ultimetly should be moved somewhere else, but not sure yet where
setupApplication = function () {
beforeEach(function() {
TW.statechart.initStatechart();
Fictum.setup();
Fictum.addResourceType('Item', {
...
});
MT.ReportTemplateContainerView = SC.ContainerView.extend({
contentView: SC.TemplateView.extend({
itemBinding: 'MT.reportTemplates.selectedItem',
templateName: 'report_template_show'
}),
editView: SC.TemplateView.extend({
itemBinding: 'MT.reportTemplates.selectedItem',
templateName: 'report_template_edit'
})
});
FakeServer.addResourceType('Item', { type: 'Boat' });
FakeServer.addResource('Item', {title: 'Super Boat' });
FakeServer.registerUrl('/search_for_item', function(resourceStore){
var items = resourceStore.allOfType('Item');
var response = {
items: items
}
return response;
});
FakeServer.addResourceType('Item', { type: 'Boat' });
FakeServer.addResource('Item', {title: 'Super Boat' });
FakeServer.registerUrl('/something', function(resourceStore){
var items = resourceStore.allOfType('Item');
var response = {
items: items
}
return response;
});
Scenario('Searching For An Item', function() {
Given('an item that is available', function() {
var itemTitle = 'item';
beforeEach(function() {
Application.server.addResource('Item', {title: itemTitle});
});
When('I am on the homepage of the application', function() {
beforeEach(function() {
Application.statechart.gotoState('started');
Page.within('.search-results', function() {
expect(Page.html()).toContain(itemTitle);
});