This file contains 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 win = Titanium.UI.createWindow({ | |
fullscreen: true, | |
backgroundColor: '#666', | |
url: 'value_for_undefined_key_subwindow.js' | |
}); | |
win.addEventListener('ready', function() { | |
// win.close causes an error only if called immediately after window is created | |
win.close(); | |
}); |
This file contains 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 movementHistory = { | |
pointAndTimeHistory: [], | |
set: function(point) { | |
// add this point into the point and time history for velocity calculations based on time & distance | |
this.pointAndTimeHistory.push({ | |
time: new Date().getTime(), | |
x: point.x, | |
y: point.y | |
}); |
This file contains 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
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
This file contains 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 circle = Titanium.UI.createView({ | |
height:200, | |
width:200, | |
borderRadius:50, | |
backgroundColor:'#336699', | |
top:10, | |
left:50 | |
}); | |
currentWindow.add(circle); |
This file contains 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
(function() { | |
Backbone.Model.prototype._save = Backbone.Model.prototype.save; | |
Backbone.Model.prototype.save = function(attrs, options) { | |
var that = this; | |
if (!options) { options = {}; } | |
if (this.savingNewRecord) { | |
// store or replace last PUT request with the latest version, we can safely replace old PUT requests with new ones | |
// but if there are callbacks from a previous PUT request, we need to make sure they are all called as well | |
_(['success','error']).each(function(event) { | |
// convert all callbacks to a single array of callbacks) |
This file contains 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
module("Calculator"); | |
test('calculator can perform basic operations', 2, function() { | |
var calc = new Calculator(); | |
equals (calc.sum(5,10), 15, 'Simple addition'); | |
equals (calc.multiple(5,5), 25, 'Simple multiplication'); | |
}); | |
test('AJAX addition operation', 2, function() { | |
stop(5000); // wait for up to 5 seconds |
This file contains 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
gem 'spork', '~> 0.9.0.rc' |
This file contains 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
@javascript | |
Scenario: confiming when saving inactive | |
Given I expect to click "OK" on a confirmation box saying "Are you sure?" | |
When I press "Save" | |
Then the confirmation box should have been displayed | |
And I should see "TV" in the "Campaign Keywords" section | |
Scenario: alert when form is not valid | |
Given I expect to click on an alert box saying "Please complete all fields in this form" | |
When I press "Save" |
This file contains 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
scenario "have ability to edit profile", :js => true do | |
@ability.should be_able_to(:edit, @profile) | |
end |
This file contains 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
require 'growl' | |
require 'open3' | |
ENV["WATCHR"] = "1" | |
$spec_cmd = "rspec --tty --drb --colour --format nested" | |
$cuke_cmd = "cucumber --color --drb --require features/step_definitions --require features/support" | |
$pass = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pass.png') | |
$fail = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'fail.png') | |
$pending = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pending.png') |
NewerOlder