Phát triển Javascript - part 28 pps

Phát triển Javascript - part 3 pps

Phát triển Javascript - part 3 pps

... www.eBookTM.com ptg Part I Test-Driven Development From the Library of WoweBook.Com Download from www.eBookTM.com ptg Preface xxiii In particular, Part II focuses on JavaScript s functions and closures; JavaScript s object ... implementation of some helper utilities, which we’ll use throughout Part III. Part III: Real-World Test-Driven Development in JavaScript In this part we’...

Ngày tải lên: 04/07/2014, 22:20

10 267 0
Phát triển Javascript - part 5 ppsx

Phát triển Javascript - part 5 ppsx

... thoroughly tested, if tested at all. Test-driven development turns thedevelopment cycle upside-down.Rather than focusing on what code is required to solve a problem, test-driven development starts by defining ... be more robust. Proper test-driven development ensures that a system will never contain code that is not being executed. 2.1.2 Design in Test-Driven Development In test-driven develop...

Ngày tải lên: 04/07/2014, 22:20

10 311 0
Phát triển Javascript - part 8 ppsx

Phát triển Javascript - part 8 ppsx

... ptg 48 Tools of the Trade "test %F should act as %Y-%m-%d": function () { assertEquals("200 9-1 0-0 2", this.date.strftime("%F")); } }); The ... Linux and OSX java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.2.1.jar tests all Listing 3.11 Running tests with JsTestDriver on Windows java -jar %JSTESTDRIVER_HOME%\JsTestDriver-1.2.1.jar tests all The ... Linux and O...

Ngày tải lên: 04/07/2014, 22:20

10 333 0
Phát triển Javascript - part 10 pps

Phát triển Javascript - part 10 pps

... testing. In Part II, JavaScript for Programmers, we will take a deep dive into JavaScript, specifically focusing on aspects of the language that sets it apart from other programming lan- guages. ... code in environments without a DOM, such as server-side JavaScript runtimes. 4.2.2 Profiling and Locating Bottlenecks Firebug, the web developer add-on for Firefox, offers a profiler that can...

Ngày tải lên: 04/07/2014, 22:20

10 275 0
Phát triển Javascript - part 12 pps

Phát triển Javascript - part 12 pps

... the one presented in Listing 5.8. The ECMAScript specification specifically calls for many built-in meth- ods to be generic, allowing them to be used with other objects that exhibit the right qualities. ... function with the first ar- gument as this. Additional arguments are passed to the function when calling it. The first example of addToArray in Listing 5.8 used this method call Ar- ray.protot...

Ngày tải lên: 04/07/2014, 22:20

10 235 0
Phát triển Javascript - part 14 ppsx

Phát triển Javascript - part 14 ppsx

... The interesting parts are the collection, index and length free variables. The iterator function re- turns an object whose methods have access to the free variables, and is an imple- mentation of ... (x < 2) { return 1; } return fibonacci(x - 1) + fibonacci(x - 2); } The Fibonacci sequence is very expensive, and quickly spawns too many recur- sive calls for a browser to handle. By...

Ngày tải lên: 04/07/2014, 22:20

10 243 0
Phát triển Javascript - part 15 pps

Phát triển Javascript - part 15 pps

... However, unlike most other object oriented languages, JavaScript does not have classes. Instead, JavaScript offers prototypes and prototype-based inheritance in which objects inherit from other objects. ... chain. The prototype chain is used to share properties across objects in JavaScript, and forms the basis for JavaScript s inheri- tance model. This concept is fundamentally different...

Ngày tải lên: 04/07/2014, 22:20

10 298 0
Phát triển Javascript - part 28 pps

Phát triển Javascript - part 28 pps

... Msxml2.XMLHTTP.6.0 installed side-by-side with Msxml2.XMLHTTP.3.0 (which comes with IE 6). This means that ei- ther Msxml2.XMLHTTP.6.0 or Microsoft.XMLHTTP is sufficient to re- trieve the newest available ... request_test.js Listing 12.2 The jsTestDriver.conf file server: http://localhost:4224 load: - lib/*.js - src/*.js - test/*.js From the Library of WoweBook.Com Download from ww...

Ngày tải lên: 04/07/2014, 22:20

10 215 0
Phát triển Javascript - part 30 pps

Phát triển Javascript - part 30 pps

... PUBLIC " ;-/ /W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; ... type="text /javascript& quot; src=" /lib/tdd.js"></script> <script type="text /javascript& quot; src=" /src/ajax.js"></scrip...

Ngày tải lên: 04/07/2014, 22:20

10 283 0
Phát triển Javascript - part 31 pps

Phát triển Javascript - part 31 pps

... coincidental. When TDD- ing, we should always add tests that we expect to fail somehow, tests that signify progress. Using POST also forces us to produce a real solution, as hard-coding POST would ... tddjs.noop; } }; transport.send(null); }; /* */ }()); Adding these two lines makes the tests pass again. Re-running the massive re- quest integration test in Internet Explorer confirms that the m...

Ngày tải lên: 04/07/2014, 22:20

10 262 0
Phát triển Javascript - part 36 pps

Phát triển Javascript - part 36 pps

... JSON data, which needs to be passed to dispatch as an object. To test this we will use the fakeXML- HttpRequest object once again, to simulate a completed request that returns with some JSON data. ... us by observable. observe, but relying on it ties the client more tightly to its dependencies. Be- sides, it’s generally not considered best practice to allow exceptions to bubble a long way thr...

Ngày tải lên: 04/07/2014, 22:20

10 182 0
Phát triển Javascript - part 38 pps

Phát triển Javascript - part 38 pps

... removing dupli- cation is the key to a flexible code base that is easy to change and mold any way we see fit. The tests are part of code base, and need constant refactoring and improve- ment too. ... directory is for third party dependencies; the other two should be self-explanatory. 14.1.1.2 Testing Framework Node has a CommonJS compliant Assert module, but in line with the low-level focus o...

Ngày tải lên: 04/07/2014, 22:20

10 192 0
Phát triển Javascript - part 42 ppsx

Phát triển Javascript - part 42 ppsx

... derivative oftheModel-View- Controller (MVC) design pattern frequently referred to as Model-View-Presenter (MVP), which is very well suited to facilitate unit testing and fits well with test-driven development. 15.1.2.1 ... www.eBookTM.com ptg 384 Server-Side JavaScript with Node.js Listing 14.75 Expecting an object passed to respond function controllerSetUp() { var req = this.req = new Even...

Ngày tải lên: 04/07/2014, 22:20

10 279 0
Phát triển Javascript - part 46 ppsx

Phát triển Javascript - part 46 ppsx

... 1px solid #333; border-radius: 12px; -moz-border-radius: 12px; -webkit-border-radius: 12px; box-shadow: 2px 2px 30px #666; -moz-box-shadow: 2px 2px 30px #666; -webkit-box-shadow: 2px 2px 30px ... Extracting the Common Parts We will take a small detour by refactoring the user form controller. We will ex- tract a formController object from which both of the controllers can in- herit. Step one ....

Ngày tải lên: 04/07/2014, 22:20

10 253 0
Phát triển Javascript - part 51 pps

Phát triển Javascript - part 51 pps

... techniques that help avoid buggy tests. By working through the example projects in Part III, Real-World Test-Driven Development in JavaScript, and viewing them from a wider angle both in this chapter and ... JsLint JsLint 1 is a JavaScript Code Quality Tool.” Inspired by lint for C, it detects syntac- tical errors, bad practices, and generally provides many more warnings than most JavaSc...

Ngày tải lên: 04/07/2014, 22:20

10 230 0
Từ khóa:
w