Test Driven JavaScript Development- P7 doc
... how JavaScript objects and properties work. We’ll also study the prototype chain as well as inheritance, working through several examples in a test- driven manner. 7.1 Objects and Properties JavaScript ... }; assertEquals(obj.prop, obj["prop"]); } }; // Grab the test var name = " ;test dots and brackets should behave identically"; var testMethod = testMethods[name...
Ngày tải lên: 03/07/2014, 05:20
... word test is run as a test method. Listing 1.10 A simple testCase function function testCase(name, tests) { assert.count = 0; var successful = 0; var testCount = 0; for (var test in tests) ... (var test in tests) { if (!/ ^test/ .test( test)) { continue; } testCount++; try { tests [test] (); output (test, "#0c0"); successful++; } catch (e) { output (test + " failed: &quo...
Ngày tải lên: 03/07/2014, 05:20
... more scripts and test scripts, an empty document is created on the fly by the test runner. JsTestDriver tests are fast. The test runner can run complex test suites of several hundred testsinunder ... src directory. Then add the test case from Listing 3.8 in test/ strftime _ test. js. Listing 3.8 Date.prototype.strftime test with JsTestDriver TestCase("strftimeTest", { s...
Ngày tải lên: 03/07/2014, 05:20
Test Driven JavaScript Development- P5 doc
... !this; }; TestCase("BooleanTest", { " ;test should flip value of true": function () { assertFalse(true.not()); assertFalse(Boolean.prototype.not.call(true)); }, " ;test should ... objects length property TestCase("FunctionTest", { " ;test function length property": function () { assertEquals(2, assert.length); assertEquals(1, document.getElementByI...
Ngày tải lên: 03/07/2014, 05:20
Test Driven JavaScript Development- P10 docx
... well with others.” Test- driven development, as described in Chapter 2, The Test- Driven Development Process, and the examples in Part III, Real-World Test- Driven Development in JavaScript, help ... Real-World Test- Driven Development in JavaScript. Before we dive into those examples, however, we will learn about unobtrusive JavaScript and feature detection in the closing two...
Ngày tải lên: 03/07/2014, 05:20
Test Driven JavaScript Development- P15 docx
... by the tests), we have several holes in tests; more tests for cases when things go wrong—methods receive the wrong kind of arguments, and other edge cases are needed. Even so, the tests document ... good idea to employ more test helpers to avoid coupling the tests too tightly to the interface being tested. I think this practice takes away some of the value of tests as documentation, and I u...
Ngày tải lên: 03/07/2014, 05:20
Test Driven JavaScript Development- P16 docx
... This makes our tests mini integration tests, as discussed in Chapter 1, Automated Testing, with the pros and cons that follow. However, as we have just developed a reasonable test suite for ajax.request, ... object (function () { var ajax = tddjs.ajax; TestCase("PollerTest", { " ;test should be object": function () { assertObject(ajax.poller); } }); }()); This test jum...
Ngày tải lên: 03/07/2014, 05:20
Test Driven JavaScript Development- P22 doc
... Feature tests for messageListController (function () { if (typeof tddjs == "undefined" || typeof document == "undefined" || !document.createElement) { return; } var element = document.createElement("dl"); if ... the greatest possible scrollTop. Listing 15.83 shows the test. Listing 15.83 Expecting the message list controller to scroll its view down TestCase(&qu...
Ngày tải lên: 03/07/2014, 05:20
test-driven javascript development
... "function"; for (var test in tests) { if (!/ ^test/ .test( test)) { continue; } testCount++; try { if (hasSetup) { tests.setUp(); } tests [test] (); output (test, "#0c0"); if (hasTeardown) { tests.tearDown(); } // ... The Unit Test, and perform some tests on the fly. Testing strftime using unit tests simply requires us to run the unit test we already wrote in all the t...
Ngày tải lên: 24/04/2014, 16:09
addison-wesley test-driven javascript development
... "function"; for (var test in tests) { if (!/ ^test/ .test( test)) { continue; } testCount++; try { if (hasSetup) { tests.setUp(); } tests [test] (); output (test, "#0c0"); if (hasTeardown) { tests.tearDown(); } // ... programming JavaScript, including topics such as unobtrusive JavaScript and feature detection. Part I: Test- Driven Development In the first part I’ll...
Ngày tải lên: 28/04/2014, 16:15