TDD in JavaScript
Now let’s try to build the task-rearrangement feature in JavaScript using TDD. You’ll use a different approach to the JavaScript than you did in the previous chapter, and you’ll be completely rewriting your JavaScript Task class. First, you’ll build the logic without regard to how the application will get data into the JavaScript objects and without regard to how the application will interact with the DOM. Approaching the feature this way allows you to focus on the code and not the large external dependencies of the server-side data and the DOM.
You still have the Capybara integration test from Chapter 9, Testing JavaScript: Integration Testing, and whatever you do here, that test should still work (or at least, should work ...
Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.