Skip to content

Instantly share code, notes, and snippets.

//Things that look like this:
initialLength = tasks.length();
//Should be changed to look like this:
initialLength = tasks.get('length');
render: function(context, firstTime){
context.push(
'<div id="something" class="some-class">',
'<div id="some-other-div" class="some-other-class">',
someVariable,
'</div>',
'</div>');
MyApp.roomsController = SC.ArrayController.create({
contentBinding: 'ClientWasp.userController.rooms',
});
@gmoeck
gmoeck / user.js
Created February 13, 2011 03:10 — forked from ahawkins/user.js
Chatter.userController = SC.ObjectController.create(
/** @scope Chatter.userController.prototype */ {
loggedInAs: function(){
var user = this.get('content');
return "Logged in as " + user.get('name');
}.property('name').cacheable()
}) ;
layout: function() {
var something = this.get('content');
return {top: something.get('row') * 100, left: something.get('column') * 100, height: 100, width: 100};
}.property('content').cacheable()
console.log('----------------- SANDBOX START -----------------')
var contentObjectController = SC.ObjectController.create()
var ContentView = SC.View.extend(SC.ContentDisplay, {
layout: function() {
var something = this.get('content') ? this.get('content') : {get: function(attribute) { return 0;} };
return {top: something.get('row') * 100, left: something.get('column') * 100, height: 100, width: 100};
}.property('content').cacheable()
Page.within('.search-results', function() {
expect(Page.html()).toContain(itemTitle);
});
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');
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;
});
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;
});