TAILIEUCHUNG - Test Driven JavaScript Development- P23

Test Driven JavaScript Development- P23:This book is about programming JavaScript for the real world, using the techniques and workflow suggested by Test-Driven Development. It is about gaining confidence in your code through test coverage, and gaining the ability to fearlessly refactor and organically evolve your code base. It is about writing modular and testable code. It is about writing JavaScript that works in a wide variety of environments and that doesn’t get in your user’s way. | The Final Chat Client 433 Listing Expecting the message form to clear message test should clear form after publish function var el input 0 NP A vision of misery assertEquals Ideally we would not clear the form until we know for sure the message was sent. Unfortunately the cometClient does not support adding a success callback at this point so the best we can do is clearing it immediately after having sent it and hope for the best. The proper fix would include adding a third options argument to cometClient and wait for success. Listing shows the message form controller s updated handleSubmit. Listing Clearing the message after publishing it function handleSubmit event . It would also be nice if the message form gave focus to the input field immediately upon initializing it. I will leave doing so as an exercise. Notes on Deployment Copy over the message form and message list controllers to chapp s public directory and reload your browser. The application should now be slightly smoother to use. Simply copying files to deploy them is cumbersome and error prone. Additionally serving the application with 15 individual script files is not optimal for performance. If you installed Ruby and RubyGems to use the jstestdriver and jsautotest tools in Chapter 3 Tools of the Trade then you have a JavaScript and CSS concatenator and minifier at your fingertips. Listing shows the three required commands to install Juicer which will conveniently package your scripts for deployment. Please purchase PDF Split-Merge on to remove this watermark. From the Library of 434 TDD and DOM Manipulation The Chat Client Listing Installing Juicer and YUI Compressor gem install juicer juicer install yui_compressor Run from the root of the application the command in Listing will produce a single file .

TÀI LIỆU MỚI ĐĂNG
3    8    0    21-10-2020
4    8    0    21-10-2020
13    7    0    21-10-2020
TÀI LIỆU HOT