Who Should Read This Guide The reader of the Gecko DOM Reference is a web developer or savvy web user who knows something about how web pages are constructed. Saturday, November 5, 11
test("a basic test example", function() { ok( true, "this test is fine" ); var value = "hello"; equal( value, "hello", "We expect value to be hello" ); }); module("Module A"); test("first test within module", function() { ok( true, "all pass" ); }); test("second test within module", function() { ok( true, "all pass" ); }); module("Module B"); test("some other test", function() { expect(2); equal( true, false, "failing test" ); equal( true, true, "passing test" ); }); Saturday, November 5, 11
test("a basic test example", function() { ok( true, "this test is fine" ); var value = "hello"; equal( value, "hello", "We expect value to be hello" ); }); module("Module A"); test("first test within module", function() { ok( true, "all pass" ); }); test("second test within module", function() { ok( true, "all pass" ); }); module("Module B"); test("some other test", function() { expect(2); equal( true, false, "failing test" ); equal( true, true, "passing test" ); }); Saturday, November 5, 11
Feature: Purchasing a book Scenario: Ordering a book When I go to the home page And I follow "Books" And I follow "Customize" And I press "Add to Cart" And I select "Standard ($7.99)" from "Shipping" And I press "Checkout" Then I should see "Order Confirmation" Saturday, November 5, 11
When /^(?:|I )press "([^"]*)"$/ do |button| click_button(button) end Then /^(?:|I )should see "([^"]*)"$/ do |text| assert page.has_content?(text) end Saturday, November 5, 11
fill = (container, liquid = "coffee") -‐> "Filling the #{container} with #{liquid}..." var fill; fill = function(container, liquid) { if (liquid == null) liquid = "coffee"; return "Filling the " + container + " with " + liquid + "..."; }; Saturday, November 5, 11
class Animal constructor: (@name) -‐> move: (meters) -‐> alert @name + " moved #{meters}m." class Snake extends Animal move: -‐> alert "Slithering..." super 5 class Horse extends Animal move: -‐> alert "Galloping..." super 45 sam = new Snake "Sammy the Python" tom = new Horse "Tommy the Palomino" sam.move() tom.move() Saturday, November 5, 11