Created
April 9, 2011 01:38
-
-
Save erichocean/911022 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CohenTest.main = function main() { | |
// Step 1: Instantiate Your Views | |
// The default code here will make the mainPane for your application visible | |
// on screen. If you app gets any level of complexity, you will probably | |
// create multiple pages and panes. | |
CohenTest.getPath('mainPage.mainPane').append() ; | |
// Step 2. Set the content property on your primary controller. | |
// This will make your app come alive! | |
now.getVersion = function(callback) { | |
console.log('now.getVersion()'); | |
var ev, layer = CohenTest.mainPage.getPath('mainPane.buttonView').get('layer'), | |
ev = SC.Event.simulateEvent(layer, 'mousedown'); | |
SC.Event.trigger(layer, 'mousedown', [ev]); | |
ev = SC.Event.simulateEvent(layer, 'mouseup'); | |
SC.Event.trigger(layer, 'mouseup', [ev]); | |
SC.RunLoop.begin(); | |
SC.RunLoop.end(); | |
callback(null, CohenTest.get('value')); | |
}; | |
now.getPath = function(path, callback) { | |
var result = SC.objectForPropertyPath(path); | |
callback(null, result); | |
}; | |
}; | |
function main() { CohenTest.main(); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var everyone = require("now").initialize(server.httpServer); | |
everyone.connected(function() { | |
var app = this.now; | |
var test = vows.describe('Vows and Now, yay!').addBatch({ | |
'App.NAMESPACE': { | |
topic: function() { | |
app.getVersion(this.callback); | |
}, | |
'is CohenTest': function(version) { | |
assert.equal(version, 'CohenTest'); | |
} | |
} | |
}); | |
var didRunTest = false; | |
for (var prop in app) { | |
console.log(prop); | |
if (!app.hasOwnProperty(prop)) continue ; | |
if (prop === 'getVersion') { | |
didRunTest = true; | |
test.run(); | |
} | |
} | |
if (!didRunTest) { | |
setTimeout(function retry() { | |
console.log('retrying getVersion() test'); | |
for (var prop in app) { | |
console.log(prop); | |
if (!app.hasOwnProperty(prop)) continue ; | |
if (prop === 'getVersion') { | |
didRunTest = true; | |
test.run(); | |
} | |
} | |
if (!didRunTest) setTimeout(retry, 1000); | |
}, 1000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment