Đang chuẩn bị liên kết để tải về tài liệu:
Test Driven JavaScript Development- P23

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

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. | 15.6 The Final Chat Client 433 Listing 15.85 Expecting the message form to clear message test should clear form after publish function var el this.element.getElementsByTagName input 0 el.value NP A vision of misery this.controller.handleSubmit this.event assertEquals el.value 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 15.86 shows the message form controller s updated handleSubmit. Listing 15.86 Clearing the message after publishing it function handleSubmit event . input.value 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. 15.6.2 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 15.87 shows the three required commands to install Juicer which will conveniently package your scripts for deployment. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. From the Library of WoweBook.Com 434 TDD and DOM Manipulation The Chat Client Listing 15.87 Installing Juicer and YUI Compressor gem install juicer juicer install yui_compressor Run from the root of the Node.js application the command in Listing 15.88 will produce a single file chat.min.js .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.