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("module 2", { | |
setup: function() { | |
$("body").append("<div id='div1'>some text</div>"); | |
}, | |
teardown: function() { | |
$("#div1").remove(); | |
} | |
}); | |
test("integrating with DOM", function() { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>QUnit Example</title> | |
<link rel="stylesheet" href="qunit.css"> | |
</head> | |
<body> | |
<div id="qunit"></div> | |
<div id="qunit-fixture"></div> |
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("module 1"); | |
test("my first test", function() { | |
ok(true); | |
}); | |
module("module 2", { | |
setup: function() { | |
}, |
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
DURATION = 9 * 60 # minutes | |
class Restroom | |
attr_reader :queue | |
attr_reader :facilities | |
def initialize(facilities_per_restroom = 3) | |
@queue = [] | |
@facilities = [] | |
facilities_per_restroom.times { @facilities << Facility.new } |
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
<head> | |
... | |
<script type="text/javascript" src="some.js"></script> | |
</head> |
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 Person = Backbone.Model.extend({ | |
defaults: { | |
name: 'Nikola', | |
age: 40, | |
job: 'developer' | |
}, | |
work: function() { | |
return this.get('name') + ' is working.'; | |
} |
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 Person = Backbone.Model.extend({ | |
defaults: { | |
name: 'Nikola', | |
age: 40, | |
job: 'developer' | |
}, | |
work: function() { | |
return this.get('name') + ' is working.'; | |
} |
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
// first method | |
function MyClass() { | |
this.name = "test class"; | |
} | |
var s = new MyClass(); | |
s.name = "some"; | |
// another one method (old-style) |
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 MyClass(name) { | |
this.name = name; | |
} | |
MyClass.prototype.say_hello = function() { | |
alert(this.name); | |
} | |
var s = new MyClass("hello"); | |
s.say_hello(); |
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 MyClass(name) { | |
this.name = name; | |
} | |
MyClass.prototype.say_hello = function() { | |
alert(this.name); | |
} | |
MyClass.prototype.say_something = function(phrase) { | |
this.name = phrase; |
OlderNewer